question

Dakafak avatar image
Dakafak asked

Cordova Mobile Ads - IOS - error 65 on build

ioserroronbuild.png I am unable to build my ios Cordova project with the amazon mobile ad plugin. I can however build the android version. I received an error code 65 in terminal so I opened the xcode project to try the build in Xcode to see more details. I received one issue "No visible @interface for 'CDAmazonMobileAds' declares the selector 'writeJavascript:'" The attachment is a screenshot of the issue and displayed file in Xcode.

I've tried removing/adding the ios platform twice and tried reinstalling the plugin. I have no idea what this error is telling me. I installed the plugin by writing "cordova plugin add <directory to unzipped AmazonMobileAds folder>"

mobile adscommunity projectsios
ioserroronbuild.png (376.0 KiB)
10 |5000

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

Ross@Amazon avatar image
Ross@Amazon answered

Hi Dakafak,

Please reference this post from a similar issue (https://github.com/Telerik-Verified-Plugins/PushNotification/issues/71):

"Easiest fix is using cordova-ios-3 (instead of 4). Btw, there is a fix in the works so this is a temporary inconvenience.

Try this:

cordova platform remove ios

cordova platform add ios@3.9.2"

10 |5000

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

TheBosZ avatar image
TheBosZ answered

I've reported the same issue here:

https://forums.developer.amazon.com/questions/30560/cordova-ads-plugin-ios-uses-deprecated-writejavasc.html

The "solution" of downgrading platform versions is not a good idea.

You can use my solution:

At the end of CDVAmazonMobileAds.m, replace the code starting at line 311:

#pragma mark AMAZONAmazonMobileAdsEventListenerDelegate

- (void)fireSDKEvent:(NSString *)eventJSONString {
    NSLog(@"SDK Event was fired");
    NSString* escapedEventString = [eventJSONString stringByReplacingOccurrencesOfString:@"'"withString:@"\\'"];
    [self.commandDelegate evalJs: [NSString stringWithFormat:@"%@.fire('%@')", kPluginName, escapedEventString]];
    NSLog(@"JS event was written");
}

@end
10 |5000

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