| Summary: | IOS crashes with AdMob framework 7.8.1 | ||
|---|---|---|---|
| Product: | SDL | Reporter: | Sylvain <sylvain.becker> |
| Component: | video | Assignee: | Alex Szpakowski <amaranth72> |
| Status: | RESOLVED FIXED | QA Contact: | Sam Lantinga <slouken> |
| Severity: | normal | ||
| Priority: | P2 | CC: | amaranth72, phil |
| Version: | don't know | ||
| Hardware: | iPhone/iPod touch | ||
| OS: | iOS (All) | ||
|
Description
Sylvain
2016-06-24 16:26:23 UTC
https://developer.apple.com/reference/uikit/uiapplicationdelegate https://developer.apple.com/reference/uikit/uiapplicationdelegate/1623056-window The apple docs say: "Implementation of this property is required if your app’s Info.plist file contains the UIMainStoryboardFile key. " (In other words it's only required if you use a Storyboard for setting up the main UI, which SDL doesn't do). I'll look into this further and if the workaround doesn't cause any problems then I'll probably implement it, but it seems like it's probably actually a bug in Admob that it doesn't check if [appdelegate window] exists before trying to call it, since iOS doesn't mandate its presence. I agree it seems optional indeed. It's technically possible not to use the internal window property. But this seems also the way apple recommend to use it. And this is how Google's Mobile Ads SDK is built, as it expects that the keyWindow is the one implemented by UIApplicationDelegate. Right, and that's a bug in Admob. But it soumds like we can work around their bug (provided that implementing our own [AppDelegate window] doesn't do anything unexpected inside iOS – which wouldn't surprise me.) I've also come across this issue while using some other ad networks. I also added this to SDL_uikitwindow.m
in
static int SetupWindowData(_THIS, SDL_Window *window, UIWindow *uiwindow, SDL_bool created)
data.uiwindow = uiwindow;
+ [UIApplication sharedApplication].delegate.window = uiwindow;
This makes sure the property is set.
Thanks!
-Phil
I committed a workaround to avoid the bugs in those third-party libraries: https://hg.libsdl.org/SDL/rev/5c8870c092ed However it hasn't been tested very thoroughly, so let me know if it works! |