kloder-games/godot-admob

iOS crash on Interstitial initialize

kristiannotari opened this issue · 3 comments

OS target (Android/iOS):
iOS

Godot version:
3.2

Issue description:
When building for iOS on Xcode the application starts then exit due to an uncaught exception:

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[AdmobInterstitial initialize::]: unrecognized selector sent to instance 0x600003fbca20'

I have followed the guide in the repo and everything works fine on Android. I'm correctly calling the init method of the AdMob singleton when on iOS platform. The error seems to be related to the last #119 PR which changed the way the Banner, Interstitial and Reward Video are initialized. The initialize method of the Interstitial and Reward Video classes define a third parameter which is not passed, as opposed to the banner initialize method which only has two. I'm not into ObjectiveC, but it looks like the third parameter is missing when invoking initialize on the two instances (Interstitial and Reward Video).

Example:

banner = [[AdmobBanner alloc] init];
[banner initialize :isReal :instanceId];

// interstitial = [AdmobInterstitial alloc]; // old way
// [interstitial initialize:isReal :instanceId :banner]; // old way but :banner passed correctly
interstitial = [[AdmobInterstitial alloc] init];
[interstitial initialize:isReal :instanceId]; // :banner not passed

// rewarded = [AdmobRewarded alloc]; // old way
// [rewarded initialize:isReal :instanceId :banner]; // old way but :banner passed correctly
rewarded = [[AdmobRewarded alloc] init];
[rewarded initialize:isReal :instanceId]; // :banner not passed

As soon as I fixed the (possibly) error described above, it started working normally on iOS (simulator, Xcode).

But I have to point out something:

  • I've used the last version of the GoogleMobileAds sdk (not found the one listed in the readme)
  • I've used some additional settings in the Xcode project in order to make it work, which are the ones described in this official google doc, in the sections manual download and update your Info.plist.

Same error here

			admob.init(OS.is_debug_build(), get_instance_id())

Resolved on #128, thanks