kloder-games / godot-admob

Module Admob for Godot engine
MIT License
360 stars 61 forks source link

iOS crash on Interstitial initialize #123

Closed kristiannotari closed 4 years ago

kristiannotari commented 4 years ago

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
kristiannotari commented 4 years ago

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:

dala00 commented 4 years ago

Same error here

            admob.init(OS.is_debug_build(), get_instance_id())
gumaciel commented 4 years ago

Resolved on #128, thanks