質問編集履歴

5

参考URLから再構築した結果を更新

2017/07/20 10:33

投稿

midomurasaki
midomurasaki

スコア46

test CHANGED
File without changes
test CHANGED
@@ -24,70 +24,434 @@
24
24
 
25
25
 
26
26
 
27
+ 実機ログ(2017/07/20 19:40編集 文字超過のため削除)
28
+
29
+
30
+
31
+
32
+
33
+
34
+
35
+
36
+
37
+
38
+
39
+ Build Settings>Linking>Other Linker Flagsに-ObjCがあるか確認しましたが、最初から入力済でした。
40
+
41
+ info.plistのATSでHTTP通信を許可してみても変化なしです。
42
+
43
+
44
+
45
+ 追加
46
+
47
+ Firebaseのバージョンを3.8.0などに落としてみたりしましたがだめでした。
48
+
49
+
50
+
51
+ ログの内容で色々とググってみましたが解決に至らず、解決方法をご存知でしたらご教示ください。
52
+
53
+
54
+
55
+
56
+
57
+
58
+
59
+
60
+
61
+ #2017/07/20 19:40追記
62
+
63
+ [https://i-app-tec.com/ios/rewarded-video-ads.html](https://i-app-tec.com/ios/rewarded-video-ads.html)
64
+
65
+ こちらの内容で再度試してみました。
66
+
67
+ サンプルコードのプロジェクトに新しくViewControllerを追加しています。
68
+
69
+ が、やはりシミュレーターでは再生OKで実機ではダメでした。
70
+
71
+
72
+
73
+ ```swift
74
+
75
+ import Firebase
76
+
77
+ import UIKit
78
+
79
+
80
+
81
+ @UIApplicationMain
82
+
83
+ class AppDelegate: UIResponder, UIApplicationDelegate {
84
+
85
+
86
+
87
+ var window: UIWindow?
88
+
89
+
90
+
91
+ func application(_ application: UIApplication,
92
+
93
+ didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
94
+
95
+ // Use Firebase library to configure APIs
96
+
97
+ FirebaseApp.configure()
98
+
99
+ // Initialize Google Mobile Ads SDK
100
+
101
+ GADMobileAds.configure(withApplicationID: "ca-app-pub-3940256099942544~1458002511")
102
+
103
+
104
+
105
+ return true
106
+
107
+ }
108
+
109
+
110
+
111
+ }
112
+
113
+ ```
114
+
115
+
116
+
117
+ ```swift
118
+
119
+ import UIKit
120
+
121
+ import GoogleMobileAds
122
+
123
+
124
+
125
+ class AdmobViewController: UIViewController, GADRewardBasedVideoAdDelegate {
126
+
127
+
128
+
129
+ // let AdMobID = "[Your AdMob ID]"
130
+
131
+ let TEST_ID = "ca-app-pub-3940256099942544/1712485313"
132
+
133
+ var AdUnitID:String? = nil
134
+
135
+
136
+
137
+ // let simulation = true
138
+
139
+
140
+
141
+ /// Is an ad being loaded.
142
+
143
+ var adRequestInProgress = false
144
+
145
+ var adRedy = false
146
+
147
+
148
+
149
+ /// The reward-based video ad.
150
+
151
+ var rewardBasedVideo: GADRewardBasedVideoAd?
152
+
153
+
154
+
155
+ // Button to show AdMob
156
+
157
+ @IBOutlet weak var playAd: UIButton!
158
+
159
+
160
+
161
+ @IBOutlet weak var statusLabel: UILabel!
162
+
163
+
164
+
165
+
166
+
167
+ override func viewDidLoad() {
168
+
169
+ super.viewDidLoad()
170
+
171
+
172
+
173
+ // if simulation {
174
+
175
+ AdUnitID = TEST_ID
176
+
177
+ // }
178
+
179
+ // else{
180
+
181
+ // AdUnitID = AdMobID
182
+
183
+ // }
184
+
185
+
186
+
187
+ rewardBasedVideo = GADRewardBasedVideoAd.sharedInstance()
188
+
189
+ rewardBasedVideo?.delegate = self
190
+
191
+
192
+
193
+ setupRewardBasedVideoAd()
194
+
195
+
196
+
197
+ }
198
+
199
+
200
+
201
+ func setupRewardBasedVideoAd(){
202
+
203
+ statusLabel.text = "set up"
204
+
205
+
206
+
207
+ if !adRequestInProgress && rewardBasedVideo?.isReady == false {
208
+
209
+ rewardBasedVideo?.load(GADRequest(),
210
+
211
+ withAdUnitID: AdUnitID! )
212
+
213
+
214
+
215
+ adRequestInProgress = true
216
+
217
+ }
218
+
219
+ else{
220
+
221
+ print("Error: setup RewardBasedVideoAd")
222
+
223
+ }
224
+
225
+ }
226
+
227
+
228
+
229
+ @IBAction func playAd(_ sender: AnyObject) {
230
+
231
+ print("adRedy=\(adRedy)")
232
+
233
+
234
+
235
+ if GADRewardBasedVideoAd.sharedInstance().isReady && adRedy{
236
+
237
+ GADRewardBasedVideoAd.sharedInstance().present(fromRootViewController: self)
238
+
239
+ adRedy = false
240
+
241
+ }
242
+
243
+ else{
244
+
245
+ print("Error: Reward based video not ready")
246
+
247
+ }
248
+
249
+ }
250
+
251
+
252
+
253
+ // MARK: GADRewardBasedVideoAdDelegate implementation
254
+
255
+ func rewardBasedVideoAd(_ rewardBasedVideoAd: GADRewardBasedVideoAd,
256
+
257
+ didFailToLoadWithError error: Error) {
258
+
259
+ adRequestInProgress = false
260
+
261
+ statusLabel.text = "failed to load"
262
+
263
+
264
+
265
+ print("Reward based video ad failed to load: \(error.localizedDescription)")
266
+
267
+ }
268
+
269
+
270
+
271
+ func rewardBasedVideoAdDidReceive(_ rewardBasedVideoAd: GADRewardBasedVideoAd) {
272
+
273
+ statusLabel.text = "ad is received"
274
+
275
+ adRequestInProgress = false
276
+
277
+ adRedy = true
278
+
279
+
280
+
281
+ print("Reward based video ad is received.")
282
+
283
+ }
284
+
285
+
286
+
287
+ func rewardBasedVideoAdDidOpen(_ rewardBasedVideoAd: GADRewardBasedVideoAd) {
288
+
289
+ statusLabel.text = "Opened reward based video ad."
290
+
291
+
292
+
293
+ print("Opened reward based video ad.")
294
+
295
+ }
296
+
297
+
298
+
299
+ func rewardBasedVideoAdDidStartPlaying(_ rewardBasedVideoAd: GADRewardBasedVideoAd) {
300
+
301
+ print("started playing.")
302
+
303
+ }
304
+
305
+
306
+
307
+ func rewardBasedVideoAdDidClose(_ rewardBasedVideoAd: GADRewardBasedVideoAd) {
308
+
309
+ statusLabel.text = "ad is closed"
310
+
311
+ setupRewardBasedVideoAd()
312
+
313
+
314
+
315
+ print("Reward based video ad is closed.")
316
+
317
+ }
318
+
319
+
320
+
321
+ func rewardBasedVideoAdWillLeaveApplication(_ rewardBasedVideoAd: GADRewardBasedVideoAd) {
322
+
323
+
324
+
325
+ print("Reward based video ad will leave application.")
326
+
327
+ }
328
+
329
+
330
+
331
+ func rewardBasedVideoAd(_ rewardBasedVideoAd: GADRewardBasedVideoAd,
332
+
333
+ didRewardUserWith reward: GADAdReward) {
334
+
335
+ print("Reward received with currency: \(reward.type), amount \(reward.amount).")
336
+
337
+ }
338
+
339
+
340
+
341
+
342
+
343
+
344
+
345
+ override func didReceiveMemoryWarning() {
346
+
347
+ super.didReceiveMemoryWarning()
348
+
349
+ // Dispose of any resources that can be recreated.
350
+
351
+ }
352
+
353
+
354
+
355
+
356
+
357
+ }
358
+
359
+
360
+
361
+ ```
362
+
363
+
364
+
27
365
  実機ログ
28
366
 
29
367
  ```
30
368
 
31
- 2017-07-19 20:57:35.608225+0900 RewardedVideoExample[13066:1335184] [DYMTLInitPlatform] platform initialization successful
32
-
33
- 2017-07-19 20:57:35.901290+0900 RewardedVideoExample[13066:1335188] [Firebase/Analytics][I-ACS023007] Firebase Analytics v.40002000 started
34
-
35
- 2017-07-19 20:57:35.901 RewardedVideoExample[13066] <Notice> [Firebase/Analytics][I-ACS023007] Firebase Analytics v.40002000 started
36
-
37
- 2017-07-19 20:57:35.901893+0900 RewardedVideoExample[13066:1335188] [Firebase/Analytics][I-ACS023008] To enable debug logging set the following application argument: -FIRAnalyticsDebugEnabled (see http://goo.gl/RfcP7r)
38
-
39
- 2017-07-19 20:57:35.902 RewardedVideoExample[13066] <Notice> [Firebase/Analytics][I-ACS023008] To enable debug logging set the following application argument: -FIRAnalyticsDebugEnabled (see http://goo.gl/RfcP7r)
40
-
41
- 2017-07-19 20:57:36.254744+0900 RewardedVideoExample[13066:1335178] [Firebase/Analytics][I-ACS032003] iAd framework is not linked. Search Ad Attribution Reporter is disabled.
42
-
43
- 2017-07-19 20:57:36.255 RewardedVideoExample[13066] <Warning> [Firebase/Analytics][I-ACS032003] iAd framework is not linked. Search Ad Attribution Reporter is disabled.
44
-
45
- 2017-07-19 20:57:36.255921+0900 RewardedVideoExample[13066:1335178] [Firebase/Analytics][I-ACS023012] Firebase Analytics enabled
46
-
47
- 2017-07-19 20:57:36.256 RewardedVideoExample[13066] <Notice> [Firebase/Analytics][I-ACS023012] Firebase Analytics enabled
48
-
49
- 2017-07-19 20:57:36.370997+0900 RewardedVideoExample[13066:1335107] [MC] System group container for systemgroup.com.apple.configurationprofiles path is /private/var/containers/Shared/SystemGroup/systemgroup.com.apple.configurationprofiles
50
-
51
- 2017-07-19 20:57:36.371934+0900 RewardedVideoExample[13066:1335107] [MC] Reading from public effective user settings.
52
-
53
- 2017-07-19 20:57:36.469236+0900 RewardedVideoExample[13066:1335178] [Firebase/Analytics][I-ACS003007] Successfully created Firebase Analytics App Delegate Proxy automatically. To disable the proxy, set the flag FirebaseAppDelegateProxyEnabled to NO in the Info.plist
54
-
55
- 2017-07-19 20:57:36.494 RewardedVideoExample[13066] <Notice> [Firebase/Analytics][I-ACS003007] Successfully created Firebase Analytics App Delegate Proxy automatically. To disable the proxy, set the flag FirebaseAppDelegateProxyEnabled to NO in the Info.plist
56
-
57
- 2017-07-19 20:57:36.667838+0900 RewardedVideoExample[13066:1335204] TIC Read Status [1:0x0]: 1:57
58
-
59
- 2017-07-19 20:57:36.669378+0900 RewardedVideoExample[13066:1335204] TIC Read Status [1:0x0]: 1:57
60
-
61
- 2017-07-19 20:57:36.847209+0900 RewardedVideoExample[13066:1335193] <Google> Cannot find an ad network adapter with the name(s): com.google.DummyAdapter. Remember to link all required ad network adapters and SDKs, and set -ObjC in the 'Other Linker Flags' setting of your build target.
369
+ 2017-07-20 19:21:10.786265+0900 RewardedVideoExample[17506:1685024] [Firebase/Analytics][I-ACS023007] Firebase Analytics v.40002000 started
370
+
371
+ 2017-07-20 19:21:10.787 RewardedVideoExample[17506] <Notice> [Firebase/Analytics][I-ACS023007] Firebase Analytics v.40002000 started
372
+
373
+ 2017-07-20 19:21:10.789715+0900 RewardedVideoExample[17506:1685024] [Firebase/Analytics][I-ACS023008] To enable debug logging set the following application argument: -FIRAnalyticsDebugEnabled (see http://goo.gl/RfcP7r)
374
+
375
+ 2017-07-20 19:21:10.791 RewardedVideoExample[17506] <Notice> [Firebase/Analytics][I-ACS023008] To enable debug logging set the following application argument: -FIRAnalyticsDebugEnabled (see http://goo.gl/RfcP7r)
376
+
377
+ 2017-07-20 19:21:11.714092+0900 RewardedVideoExample[17506:1684957] [MC] System group container for systemgroup.com.apple.configurationprofiles path is /private/var/containers/Shared/SystemGroup/systemgroup.com.apple.configurationprofiles
378
+
379
+ 2017-07-20 19:21:11.716054+0900 RewardedVideoExample[17506:1684957] [MC] Reading from public effective user settings.
380
+
381
+ 2017-07-20 19:21:12.132385+0900 RewardedVideoExample[17506:1685033] TIC Read Status [1:0x0]: 1:57
382
+
383
+ 2017-07-20 19:21:12.132457+0900 RewardedVideoExample[17506:1685033] TIC Read Status [1:0x0]: 1:57
384
+
385
+ 2017-07-20 19:21:12.364643+0900 RewardedVideoExample[17506:1685066] [Firebase/Analytics][I-ACS003007] Successfully created Firebase Analytics App Delegate Proxy automatically. To disable the proxy, set the flag FirebaseAppDelegateProxyEnabled to NO in the Info.plist
386
+
387
+ 2017-07-20 19:21:12.366 RewardedVideoExample[17506] <Notice> [Firebase/Analytics][I-ACS003007] Successfully created Firebase Analytics App Delegate Proxy automatically. To disable the proxy, set the flag FirebaseAppDelegateProxyEnabled to NO in the Info.plist
388
+
389
+ 2017-07-20 19:21:12.420720+0900 RewardedVideoExample[17506:1685066] [Firebase/Analytics][I-ACS032003] iAd framework is not linked. Search Ad Attribution Reporter is disabled.
390
+
391
+ 2017-07-20 19:21:12.421 RewardedVideoExample[17506] <Warning> [Firebase/Analytics][I-ACS032003] iAd framework is not linked. Search Ad Attribution Reporter is disabled.
392
+
393
+ 2017-07-20 19:21:12.422509+0900 RewardedVideoExample[17506:1685066] [Firebase/Analytics][I-ACS023012] Firebase Analytics enabled
394
+
395
+ 2017-07-20 19:21:12.422 RewardedVideoExample[17506] <Notice> [Firebase/Analytics][I-ACS023012] Firebase Analytics enabled
396
+
397
+ 2017-07-20 19:21:12.507906+0900 RewardedVideoExample[17506:1685028] <Google> Cannot find an ad network adapter with the name(s): com.google.DummyAdapter. Remember to link all required ad network adapters and SDKs, and set -ObjC in the 'Other Linker Flags' setting of your build target.
62
398
 
63
399
  Reward based video ad failed to load: No ad returned from any ad server.
64
400
 
401
+ 2017-07-20 19:21:27.199211+0900 RewardedVideoExample[17506:1685066] TIC Read Status [5:0x0]: 1:57
402
+
403
+ 2017-07-20 19:21:27.199416+0900 RewardedVideoExample[17506:1685066] TIC Read Status [5:0x0]: 1:57
404
+
65
- 2017-07-19 20:57:50.929078+0900 RewardedVideoExample[13066:1335107] API error: (null) returned 0 width, assuming UIViewNoIntrinsicMetric
405
+ 2017-07-20 19:21:27.202074+0900 RewardedVideoExample[17506:1685066] [Firebase/Analytics][I-ACS023130] Configuration not found. Using default configuration
406
+
66
-
407
+ 2017-07-20 19:21:27.202 RewardedVideoExample[17506] <Warning> [Firebase/Analytics][I-ACS023130] Configuration not found. Using default configuration
408
+
67
- 2017-07-19 20:57:50.929178+0900 RewardedVideoExample[13066:1335107] API error: (null) returned 0 width, assuming UIViewNoIntrinsicMetric
409
+ 2017-07-20 19:21:27.420460+0900 RewardedVideoExample[17506:1685157] TIC Read Status [6:0x0]: 1:57
410
+
68
-
411
+ 2017-07-20 19:21:27.420599+0900 RewardedVideoExample[17506:1685157] TIC Read Status [6:0x0]: 1:57
412
+
69
-
413
+ adRedy=false
414
+
70
-
415
+ Error: Reward based video not ready
416
+
417
+
418
+
71
- ```
419
+ ```
420
+
421
+
422
+
423
+
424
+
72
-
425
+ ```swift
426
+
73
-
427
+ func rewardBasedVideoAd(_ rewardBasedVideoAd: GADRewardBasedVideoAd,
428
+
74
-
429
+ didFailToLoadWithError error: Error) {
430
+
75
-
431
+ adRequestInProgress = false
432
+
76
-
433
+ statusLabel.text = "failed to load"
434
+
435
+
436
+
77
-
437
+ print("Reward based video ad failed to load: \(error.localizedDescription)")
438
+
78
-
439
+ }
440
+
79
-
441
+ ```
442
+
80
-
443
+ からは
444
+
445
+ ```
446
+
447
+ Reward based video ad failed to load: No ad returned from any ad server.
448
+
449
+ ```
450
+
451
+ と返ってきます。
452
+
81
- ```Build Settings```>```Linking```>```Other Linker Flags```に```-ObjC```があるか確認ましが、最初から入力済でし
453
+ なお、自分で作成したプロジェクト上で、ApplicationIDとGoogleService-Info.plistをFirebaseより生成したもの実行ても結果は同じです
82
-
83
- ```info.plist```のATSでHTTP通信を許可してみても変化なしです。
454
+
84
-
85
-
86
-
87
- 追加
455
+
88
-
456
+
89
- Firebaseバージョンを3.8.0どに落としてみたしたがだめでした
457
+ シミュレーターではできるに実機で出来い理由がわかりません。。
90
-
91
-
92
-
93
- ログの内容で色々とググってみましたが解決に至らず、解決方法をご存知でしたらご教示ください。

4

サンプルのファイルパス追加

2017/07/20 10:33

投稿

midomurasaki
midomurasaki

スコア46

test CHANGED
File without changes
test CHANGED
@@ -4,7 +4,13 @@
4
4
 
5
5
  googleが提供しているサンプルを[こちら](https://github.com/googleads/googleads-mobile-ios-examples)からダウンロードし、```pod install```、```pod update```をした上でシミュレーター上で実行すると問題無く動画が再生されます。
6
6
 
7
+
8
+
7
9
  サンプルURL:[https://github.com/googleads/googleads-mobile-ios-examples](https://github.com/googleads/googleads-mobile-ios-examples)
10
+
11
+ ファイル: ```googleads-mobile-ios-examples-master/Swift/admob/RewardedVideoExample/RewardedVideoExample.xcworkspace```
12
+
13
+
8
14
 
9
15
  ですが、実機で実行するとエラーのアラートとログが出力され、動画が再生できません。
10
16
 

3

表示の不具合を修正

2017/07/20 08:33

投稿

midomurasaki
midomurasaki

スコア46

test CHANGED
File without changes
test CHANGED
@@ -70,13 +70,17 @@
70
70
 
71
71
 
72
72
 
73
+
74
+
73
75
  ```Build Settings```>```Linking```>```Other Linker Flags```に```-ObjC```があるか確認しましたが、最初から入力済でした。
74
76
 
75
77
  ```info.plist```のATSでHTTP通信を許可してみても変化なしです。
76
78
 
79
+
80
+
77
81
  追加
78
82
 
79
- ```Firebase```のバージョンを3.8.0などに落としてみたりしましたがだめでした。
83
+ Firebaseのバージョンを3.8.0などに落としてみたりしましたがだめでした。
80
84
 
81
85
 
82
86
 

2

表示がおかしい部分を修正

2017/07/20 08:28

投稿

midomurasaki
midomurasaki

スコア46

test CHANGED
File without changes
test CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  googleが提供しているサンプルを[こちら](https://github.com/googleads/googleads-mobile-ios-examples)からダウンロードし、```pod install```、```pod update```をした上でシミュレーター上で実行すると問題無く動画が再生されます。
6
6
 
7
- サンプルURL:[h![イメージ説明](ee85a044508a784b8b83e3e73b280d2e.png)/github.com/googleads/googleads-mobile-ios-examples](https://github.com/googleads/googleads-mobile-ios-examples)
7
+ サンプルURL:[https://github.com/googleads/googleads-mobile-ios-examples](https://github.com/googleads/googleads-mobile-ios-examples)
8
8
 
9
9
  ですが、実機で実行するとエラーのアラートとログが出力され、動画が再生できません。
10
10
 

1

サンプルのURLを直接表示し、シミュレーターのスクリーンショットと試したことを追加

2017/07/20 08:26

投稿

midomurasaki
midomurasaki

スコア46

test CHANGED
File without changes
test CHANGED
@@ -3,6 +3,8 @@
3
3
 
4
4
 
5
5
  googleが提供しているサンプルを[こちら](https://github.com/googleads/googleads-mobile-ios-examples)からダウンロードし、```pod install```、```pod update```をした上でシミュレーター上で実行すると問題無く動画が再生されます。
6
+
7
+ サンプルURL:[h![イメージ説明](ee85a044508a784b8b83e3e73b280d2e.png)/github.com/googleads/googleads-mobile-ios-examples](https://github.com/googleads/googleads-mobile-ios-examples)
6
8
 
7
9
  ですが、実機で実行するとエラーのアラートとログが出力され、動画が再生できません。
8
10
 
@@ -10,9 +12,9 @@
10
12
 
11
13
 
12
14
 
13
- スクリーンショット
15
+ スクリーンショット(左:実機, 右:シミュレーター)
14
16
 
15
- ![イメージ説明](3281add15973a8a5e9e39e056f9e7763.png)
17
+ ![実機](3281add15973a8a5e9e39e056f9e7763.png) ![シミュレーター](a3067fe5bc71a90754a1bb4e1a9cf013.png)
16
18
 
17
19
 
18
20
 
@@ -72,6 +74,10 @@
72
74
 
73
75
  ```info.plist```のATSでHTTP通信を許可してみても変化なしです。
74
76
 
77
+ 追加
78
+
79
+ ```Firebase```のバージョンを3.8.0などに落としてみたりしましたがだめでした。
80
+
75
81
 
76
82
 
77
83
  ログの内容で色々とググってみましたが解決に至らず、解決方法をご存知でしたらご教示ください。