We have an issue not being able to show ads. In particular, interstitial ad loads seem to consistently fail. This issue is for an update to an existing iOS app which we believe we have set up correctly to receive Ads from Amazon.
This is an extract from our info.plist config:
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
<key>NSAllowsArbitraryLoadsInWebContent</key>
<true/>
</dict>
This is a code snippet of the relevant operation:
/// RELEVANT PARTS OF THE AMAZONADS IMPLEMENTATION
@interface AmazonAdsDelegate : UIViewController <AmazonAdInterstitialDelegate>
@property (strong, nonatomic) AmazonAdInterstitial* interstitialRef;
-(void)interstitialDidLoad : (AmazonAdInterstitial *)interstitial;
-(void)interstitialDidFailToLoad : (AmazonAdInterstitial *)interstitial withError : (AmazonAdError *)error;
-(void)interstitialWilPresent : (AmazonAdInterstitial *)interstitial;
-(void)interstitialDidPresent : (AmazonAdInterstitial *)interstitial;
-(void)interstitialWillDismiss : (AmazonAdInterstitial *)interstitial;
-(void)interstitialDidDismiss : (AmazonAdInterstitial *)interstitial;
@end
// ----- AmazonAds
class AmazonAds
{
// ...
AmazonAdInterstitial*m_Interstitial;
AmazonAdsDelegate*m_AdDelegate;
public:
// ...
void StartSession(String apiKeyID);
void PreLoadAd();
bool IsAdAvailable();
void DisplayAd();
};
// AmazonAds Delegate
@implementation AmazonAdsDelegate
-(void)interstitialDidLoad : (AmazonAdInterstitial *)interstitial
{
bbPrint(String("AmazonAds interstitialDidLoad"));
}
-(void)interstitialDidFailToLoad : (AmazonAdInterstitial *)interstitial withError : (AmazonAdError *)error
{
bbPrint(String("AmazonAds interstitialDidFailToLoad: ") + String(error.errorCode) + String(": ") + String(error.errorDescription));
}
-(void)interstitialWilPresent : (AmazonAdInterstitial *)interstitial
{
}
-(void)interstitialDidPresent : (AmazonAdInterstitial *)interstitial
{
}
-(void)interstitialWillDismiss : (AmazonAdInterstitial *)interstitial
{
}
-(void)interstitialDidDismiss : (AmazonAdInterstitial *)interstitial
{
}
@end
// ----- /AmazonAds Delegate
void AmazonAds::StartSession(String apiKeyID)
{
[[AmazonAdRegistration sharedRegistration] setAppKey:apiKeyID.ToNSString()];
[[AmazonAdRegistration sharedRegistration] setLogging:YES];
m_Interstitial = [AmazonAdInterstitial amazonAdInterstitial];
m_Interstitial.delegate = m_AdDelegate;
}
void AmazonAds::PreLoadAd()
{
AmazonAdOptions *options = [AmazonAdOptions options];
//options.isTestRequest = YES;
[m_Interstitial load : options];
bbPrint(String("AmazonAds PreLoadAd request"));
}
bool AmazonAds::IsAdAvailable()
{
if(m_Interstitial)
{
bool ready = m_Interstitial.isReady;
return ready;
}
return false;
}
void AmazonAds::DisplayAd()
{
[m_Interstitial presentFromViewController : viewControllerRef];
}
And this is the output from the app / internal amazon logs:
===========================================
=SESSION START=
===========================================
AmazonAds On Start
HERE IS THE CALL FOR [m_Interstitial load : options];
AdMan - RefreshInterstitialAds preload request AmazonAds
THIS IS THE LOG SHORTLY AFTER THE load CALL
2017-11-30 14:04:03.194252 soccer[2876:1549091] AmazonAd [Error]: Interstitial is not ready. Load interstitial or wait for the load to finish if already loading.
2017-11-30 14:04:03.195183 soccer[2876:1549091] AmazonAd [Debug]: METRIC Increment lac
2017-11-30 14:04:03.195324 soccer[2876:1549091] AmazonAd [Debug]: METRIC Start i_tl
2017-11-30 14:04:03.195452 soccer[2876:1549091] AmazonAd [Debug]: METRIC Increment i_adrc
2017-11-30 14:04:03.196030 soccer[2876:1549091] AmazonAd [Debug]: -[AMAdConfiguration bootstrapConfigurationOnSuccess:onError:fromIdentityModule:]: reusing existing config
2017-11-30 14:04:03.196863 soccer[2876:1549091] AmazonAd [Info]: Bootstrap device skipped : within frequency time interval
2017-11-30 14:04:03.204504 soccer[2876:1549091] AmazonAd [Debug]: -[AMAdConfiguration bootstrapConfigurationOnSuccess:onError:fromIdentityModule:]: reusing existing config
2017-11-30 14:04:03.205495 soccer[2876:1549091] AmazonAd [Debug]: No events to register. Could not register events
2017-11-30 14:04:03.216185 soccer[2876:1549091] AmazonAd [Debug]: Cached IDFA: 83DEF662-1306-478C-96FF-1AEB0CC47D8A Current IDFA: 83DEF662-1306-478C-96FF-1AEB0CC47D8A
2017-11-30 14:04:03.226173 soccer[2876:1549091] Could not successfully update network info during initialization.
2017-11-30 14:04:03.229830 soccer[2876:1549091] AmazonAd [Debug]: Trying to get Json object from an object that is not a string
2017-11-30 14:04:03.230021 soccer[2876:1549091] AmazonAd [Debug]: Trying to get Json object from an object that is not a string
2017-11-30 14:04:03.230274 soccer[2876:1549091] AmazonAd [Debug]: Trying to get Json object from an object that is not a string
2017-11-30 14:04:03.230484 soccer[2876:1549091] AmazonAd [Debug]: Trying to get Json object from an object that is not a string
2017-11-30 14:04:03.230723 soccer[2876:1549091] AmazonAd [Debug]: Trying to get Json object from an object that is not a string
2017-11-30 14:04:03.231563 soccer[2876:1549091] AmazonAd [Debug]: METRIC Start al
2017-11-30 14:04:03.232921 soccer[2876:1549091] AmazonAd [Info]: AMAInterstitialAdManager (0x1712d23d0) fired initial ad request.
Ad Request URL https://aax-eu.amazon-adsystem.com/e/msdk/ads
Http headers {"User-Agent":"Mozilla\/5.0 (iPod touch; CPU iPhone OS 10_1_1 like Mac OS X) AppleWebKit\/602.2.14 (KHTML, like Gecko) Mobile\/14B100 AmazonAdSDK-iOS\/2.2.15.1","Content-Type":"application\/json; charset=UTF-8","Accept":"application\/json"}
Http body{"ats":"false","dinfo":{"make":"Apple","os":"iOS","country":"AT","connectionType":"Wifi","osVersion":"10.1.1","model":"iPod7,1","language":"en-AT","screenSize":"640x1136","scalingFactor":"2.0","orientation":"portrait"},"slots":[{"slot":"portrait","slotId":1,"sz":"interstitial","video":{"minAdDuration":0,"maxAdDuration":30000},"supportedMediaTypes":["DISPLAY","VIDEO"]}],"ua":"Mozilla\/5.0 (iPod touch; CPU iPhone OS 10_1_1 like Mac OS X) AppleWebKit\/602.2.14 (KHTML, like Gecko) Mobile\/14B100 AmazonAdSDK-iOS\/2.2.15.1","appId":"5783448258644511a363763c646b4e0d","oo":"false","ad-id":"A1jikLo55EdKtPJmFwOt8PY","ad
AmazonAds PreLoadAd request
2017-11-30 14:04:03.744936 soccer[2876:1550235] AppTracker Info: [E007] Invalid location code (video)
2017-11-30 14:04:03.745741 soccer[2876:1550235] AppTracker Info: Module video failed to cache:no fill
2017-11-30 14:04:03.908512 soccer[2876:1549091] AmazonAd [Info]: AMAInterstitialAdManager (0x1712d23d0) received valid response from AAX server.
2017-11-30 14:04:03.909562 soccer[2876:1549091] AmazonAd [Debug]: METRIC Stop al
2017-11-30 14:04:03.910510 soccer[2876:1549091] AmazonAd [Info]: Interstitial Ad manager (0x1712d23d0) received ad payload data string {"noretryTTL":10,"instrPixelURL":"https://aax-eu.amazon-adsystem.com/x/px/p/QrhwKCDxsk3sMytE60PDTYIAAAFgDQbkOAMAAA-gAwWeJvE/","errorMessage":"no results","errorCode":"503","status":"error"}
2017-11-30 14:04:03.913148 soccer[2876:1549091] AmazonAd [Debug]: METRIC Increment alf
2017-11-30 14:04:03.913924 soccer[2876:1549091] AmazonAd [Debug]: METRIC Increment ttl
2017-11-30 14:04:03.916274 soccer[2876:1549091] AmazonAd [Info]: AMAInterstitialAdManager (0x1712d23d0) failed to get a valid response from AAX server. Error: Error Domain=AMAdManagerError Code=1 "Try again in 9.999206 seconds." UserInfo={NSLocalizedDescription=Try again in 9.999206 seconds.}
2017-11-30 14:04:03.916756 soccer[2876:1549091] AmazonAd [Debug]: METRIC Increment lfnf
2017-11-30 14:04:03.918328 soccer[2876:1549091] AmazonAd [Info]: MobileAdsiOSSDK_:Failure_LoadAdNoFill_amznAdSDK-ios-2.2.15.1 metric fired: https://fls-eu.amazon.com/1/action-impressions/1/OE/mobile-ads-sas/action/MobileAdsiOSSDK_:Failure_LoadAdNoFill_amznAdSDK-ios-2.2.15.1?marketplaceId=533739843&requestId=533739843&session=533739843
2017-11-30 14:04:03.921638 soccer[2876:1549091] AmazonAd [Debug]: Interstitial Ad failed to load. Error code 1: Try again in 9.999206 seconds.
2017-11-30 14:04:03.923558 soccer[2876:1549091] AmazonAd [Debug]: METRIC Stop i_tfl
2017-11-30 14:04:03.926651 soccer[2876:1549091] AmazonAd [Debug]: METRIC Increment lf
2017-11-30 14:04:03.929958 soccer[2876:1549091] AmazonAd [Debug]: METRIC Submit for object 0x1712d23d0
2017-11-30 14:04:03.931598 soccer[2876:1549091] AmazonAd [Debug]: GET https://aax-eu.amazon-adsystem.com/x/px/p/QrhwKCDxsk3sMytE60PDTYIAAAFgDQbkOAMAAA-gAwWeJvE/%7B%22i_adrc%22%3A1%2C%22c%22%3A%22msdki%22%2C%22i_tfl%22%3A728%2C%22lf%22%3A1%2C%22al%22%3A678%2C%22alf%22%3A1%2C%22ttl%22%3A1%2C%22lfnf%22%3A1%2C%22lac%22%3A1%7D
EventListener -> "amazonads-interstitial-advert-failed-load" Event Received
HERE IS THE DELEGATE'S interstitialDidFailToLoad CALL
AmazonAds interstitialDidFailToLoad: 1: Try again in 9.999206 seconds.
EventListener -> "amazonads-interstitial-advert-failed-load" Returned True for event triggered: 2017-11-30 14:04:04.654458 soccer[2876:1550212] AmazonAd [Debug]: Response: 200 no error
2017-11-30 14:04:04.654696 soccer[2876:1550212] AmazonAd [Debug]: Sending metrics to AAX succeeded.
2017-11-30 14:04:04.699290 soccer[2876:1550237] AmazonAd [Debug]: AMAMetricManager (0x174011a90) successfully fired metric