2017-01-15 5 views
1

Я пытаюсь проверить MoPub междоузлий с тестовым идентификатором в MoPub учебниках, версия Иоса 10,2, MoPub выходыMoPub интерстициальный не загружая

2017-01-15 13:47:46.801224 Twit Miner[23775:6627095] MOPUB: Looking for custom event class named MPHTMLInterstitialCustomEvent. 
2017-01-15 13:47:46.801321 Twit Miner[23775:6627095] MOPUB: Loading MoPub HTML interstitial 
2017-01-15 13:47:46.999975 Twit Miner[23775:6627095] MOPUB: MoPub HTML interstitial did load 

Но я не вижу никаких интерстициальное отображения объявлений. Вы можете найти свой код ниже:

import UIKit 
import MoPub 

class ViewController: UIViewController 
, MPInterstitialAdControllerDelegate 

{ 
    // TODO: Replace this test id with your personal ad unit id 
    var interstitial: MPInterstitialAdController = 
     MPInterstitialAdController(forAdUnitId: "77ce0b65cf81438eb255695afe3b1904") 

    override func viewDidLoad() { 
     super.viewDidLoad() 

     self.interstitial.delegate = self 
     // Pre-fetch the ad up front 
     self.interstitial.loadAd() 
    } 

    func interstitialDidLoadAd(interstitial: MPInterstitialAdController) { 
     // This sample automatically shows the ad as soon as it's loaded, but 
     // you can move this showFromViewController call to a time more 
     // appropriate for your app. 
     if (interstitial.ready) { 
      interstitial.showFromViewController(self) 
     } 
    } 
} 

Даже если журнал говорит иначе, когда я ставлю точку останова, я понял, что метод interstitialDidLoadAd никогда не вызывается. Я думал, что это может быть связано с АТС, так что я добавил следующие ключи к info.plist:

<key>NSAppTransportSecurity</key> 
    <dict> 
     <key>NSAllowsArbitraryLoads</key> 
     <true/> 
     <key>NSAllowsArbitraryLoadsForMedia</key> 
     <true/> 
     <key>NSAllowsArbitraryLoadsInWebContent</key> 
     <true/> 
    </dict> 

еще не повезло, может кто-то сказать мне, что я, вероятно, делаю неправильно?

ответ

0

Я понимаю, что это может быть слишком поздно.

Проверьте, если у вас есть следующие записи журнала:

A location manager (0x143ebb150) was created on a dispatch queue 
executing on a thread other than the main thread. It is the 
developer's responsibility to ensure that there is a run loop running 
on the thread on which the location manager object is allocated. In 
particular, creating location managers in arbitrary dispatch queues 
(not attached to the main queue) is not supported and will result in 
callbacks not being received. 

Просто до:

MOPUB: Interstitial controller is loading ad with MoPub server URL: 

Если это так, попробуйте диспетчерская loadAd метод на главной очереди, как это.

Objective-C

dispatch_async(dispatch_get_main_queue(), ^{ 
    [self.interstitial loadAd]; 
}); 

Свифта 3

DispatchQueue.main.async { 
    self.interstitial.loadAd() 
}