question

Devastating avatar image
Devastating asked

Amazon Ads fail to load - NSURLConnection finished with error - code -1002

Hello,

I am trying to create a native Unity plugin to implement Amazon Ads SDK into Unity, I am not very good with Objective-C, so I may be making a mistake somewhere, but through much debugging I could not figure out what error code 1002 means exactly.

Here is part of my debug log when I attempt to load an amazon ad through a Unity button, which then calls a function in the obj-c plugin.

2019-09-05 15:25:11.700871-0400 AmazonPluginTest[1901:1254395] AmazonAd [Info]: Ad view (0x282dc01c0) received valid response from AAX server.
2019-09-05 15:25:11.702115-0400 AmazonPluginTest[1901:1254395] AmazonAd [Debug]: METRIC Stop al
2019-09-05 15:25:11.702444-0400 AmazonPluginTest[1901:1254395] AmazonAd [Info]: Ad manager (0x282dc01c0) received ad payload data string {"ads":[{"cacheRank":1,"cacheTTL":300,"impPixelURL":"https://aax-us-east.amazon-adsystem.com/e/msdk/imp?b=Is0GPpAXH60YfQFwo_EcBx8AAAFtAuNEdAEAAA-hAh652j8","size":"320x50","slotCpms":[],"instrPixelURL":"https://aax-us-east.amazon-adsystem.com/x/px/Is0GPpAXH60YfQFwo_EcBx8AAAFtAuNEdAEAAA-hAh652j8/","html":"\r\n<head><script src=\"amazon.js\"><\/script><script src=\"mraid.js\"><\/script><\/head><head><style>.ac{display:block;position:absolute;overflow:hidden;width:18px;height:14px;z-index:9;top:0;right:0;background:url(https://images-na.ssl-images-amazon.com/images/G/01/da/adchoices/ac-topright-sprite.png)}#vpc-logo{padding:0;position:absolute;background-repeat:no-repeat;background-position:50% 100%;height:15px;width:100%;bottom:16px;left:0;height:18px;width:17px}.hide{display:none!important}html,body{height:50px}#mobile-ads-ad{height:100%;overflow:hidden}#mobile-ads-link{position:relative;overflow:hidden}#mobile-ad-image{width:100%;height
2019-09-05 15:25:11.705988-0400 AmazonPluginTest[1901:1254395] AmazonAd [Info]: MobileAdsiOSSDK_:ATSDisabled_LoadAd_amznAdSDK-ios-2.2.15.1 metric fired: https://fls-na.amazon.com/1/action-impressions/1/OE/mobile-ads-sas/action/MobileAdsiOSSDK_:ATSDisabled_LoadAd_amznAdSDK-ios-2.2.15.1?marketplaceId=589404311&requestId=589404311&session=589404311
2019-09-05 15:25:11.707956-0400 AmazonPluginTest[1901:1254395] AmazonAd [Debug]: METRIC Start mal
2019-09-05 15:25:11.721287-0400 AmazonPluginTest[1901:1254395] AmazonAd [Debug]: Fragment detected: converting to full payload.
2019-09-05 15:25:11.722322-0400 AmazonPluginTest[1901:1254395] AmazonAd [Debug]: Ad view (0x282dc01c0) loaded HTML content: 

<head><script src="amazon.js"></script><script src="mraid.js"></script></head><head><style>.ac{display:block;position:absolute;overflow:hidden;width:18px;height:14px;z-index:9;top:0;right:0;background:url(https://images-na.ssl-images-amazon.com/images/G/01/da/adchoices/ac-topright-sprite.png)}#vpc-logo{padding:0;position:absolute;background-repeat:no-repeat;background-position:50% 100%;height:15px;width:100%;bottom:16px;left:0;height:18px;width:17px}.hide{display:none!important}html,body{height:50px}#mobile-ads-ad{height:100%;overflow:hidden}#mobile-ads-link{position:relative;overflow:hidden}#mobile-ad-image{width:100%;height:auto}</style></head><body style="margin:0px;padding:0px;text-align:center;overflow:hidden;"><div id="mobile-ads-ad"><a id="mobile-ads-link"><img id="mobile-ad-image"></a></div><script id="iframe_script">document.ad={aid:"4758883110801",cid:"5276225358998",w:320,h:50,template:"Image - mobile AAP-1.278"},window.aanResponse={ad
2019-09-05 15:25:11.727798-0400 AmazonPluginTest[1901:1254395] AmazonAd [Info]: Ad started loading in the webview
2019-09-05 15:25:12.303333-0400 AmazonPluginTest[1901:1254687] NSURLConnection finished with error - code -1002
2019-09-05 15:25:12.304829-0400 AmazonPluginTest[1901:1254687] NSURLConnection finished with error - code -1002
2019-09-05 15:25:12.310381-0400 AmazonPluginTest[1901:1254395] AmazonAd [Debug]: METRIC Stop mal
2019-09-05 15:25:12.311468-0400 AmazonPluginTest[1901:1254395] AmazonAd [Debug]: Scheduled MPTimer (0x281a2db30).
2019-09-05 15:25:12.311708-0400 AmazonPluginTest[1901:1254395] AmazonAd [Debug]: Ad will be resized.
2019-09-05 15:25:12.312136-0400 AmazonPluginTest[1901:1254395] AmazonAd [Debug]: Ad Loaded.
2019-09-05 15:25:12.312176-0400 AmazonPluginTest[1901:1254395] AmazonAd [Debug]: METRIC Stop tl
2019-09-05 15:25:12.312286-0400 AmazonPluginTest[1901:1254395] AmazonAd [Debug]: METRIC Submit for object 0x282dc01c0
2019-09-05 15:25:12.312328-0400 AmazonPluginTest[1901:1254395] AmazonAd [Debug]: GET https://aax-us-east.amazon-adsystem.com/x/px/Is0GPpAXH60YfQFwo_EcBx8AAAFtAuNEdAEAAA-hAh652j8/%7B%22b_adrc%22%3A1%2C%22lac%22%3A1%2C%22c%22%3A%22msdki%22%2C%22mal%22%3A602%2C%22al%22%3A339%2C%22tl%22%3A1227%2C%22rl%22%3A602%7D
2019-09-05 15:25:12.312985-0400 AmazonPluginTest[1901:1254395] Ad loaded


This is the code being called:

const CGRect adFrame = CGRectMake(0.0f, 20.0f, [UIScreen mainScreen].bounds.size.width, 90.0f);
        
        
        self.amazonAdView = [[AmazonAdView alloc] initWithFrame:adFrame];
        [self.amazonAdView setHorizontalAlignment:AmazonAdHorizontalAlignmentCenter];
        [self.amazonAdView setVerticalAlignment:AmazonAdVerticalAlignmentFitToContent
        
        amazonAdView.delegate = self;
        
        //Set the ad options and load the ad
        AmazonAdOptions *options = [AmazonAdOptions options];
        options.isTestRequest = YES;
        [amazonAdView loadAd:options];
        
        UIApplication *app = [UIApplication sharedApplication];
        UIWindow *window = [app keyWindow];

        [window addSubview:amazonAdView];


This does not show anything in the app, on top of the Unity view, but that may be because I am not implementing it right, however I'm not sure what the 1002 error code means. When I test the sample demos those requests return a 200 code with no error, there must be something I'm not doing right.

Update:
I've got a UIView loading on top of the Unity view controller, however it comes up as blank, even though it has added the amazonAdView as a subView.

Any guidance is greatly appreciated!

mobile adsiosunity
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

0 Answers