Open KrizCologne opened 1 year ago
Probably something is not initialized yet while you try to load ad interstitial.
I would move MobileAds.SharedInstance.Start(CompletionHandler); before LoadApplication as I think you are loading an interstitial directly when you load your app. This might solve the problem.
@marcojak When I do it that way, I got the following crash when calling MobileAds.SharedInstance.Start(CompletionHandler):
13:09:50:416 [0:] An error occurred: 'Object reference not set to an instance of an object.'. Callstack: ' at Blank.AppDelegate.FinishedLaunching (UIKit.UIApplication application, Foundation.NSDictionary launchOptions) [0x0000d] in C:\Users\CRoeder\source\repos\Privat\PLUTester\PLUTester\PLUTester.iOS\AppDelegate.cs:26
13:09:50:416 at (wrapper managed-to-native) UIKit.UIApplication.xamarin_UIApplicationMain(int,string[],intptr,intptr,intptr&)
13:09:50:416 at UIKit.UIApplication.UIApplicationMain (System.Int32 argc, System.String[] argv, System.IntPtr principalClassName, System.IntPtr delegateClassName) [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/16.0.0.92/src/Xamarin.iOS/UIKit/UIApplication.cs:57
13:09:50:416 at UIKit.UIApplication.Main (System.String[] args, System.Type principalClass, System.Type delegateClass) [0x0003b] in /Library/Frameworks/Xamarin.iOS.framework/Versions/16.0.0.92/src/Xamarin.iOS/UIKit/UIApplication.cs:92
13:09:50:416 at PLUTester.iOS.Application.Main (System.String[] args) [0x00001] in C:\Users\CRoeder\source\repos\Privat\PLUTester\PLUTester\PLUTester.iOS\Main.cs:12
13:09:50:416 at (wrapper managed-to-native) System.Reflection.RuntimeMethodInfo.InternalInvoke(System.Reflection.RuntimeMethodInfo,object,object[],System.Exception&)
13:09:50:416 at System.Reflection.RuntimeMethodInfo.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x0006a] in /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/mcs/class/corlib/System.Reflection/RuntimeMethodInfo.cs:395 '
Have you found a solution to this issue? I'm having the same problem, MobileAds.SharedInstance is null. I tried calling MobileAds.SharedInstance.Start(CompletionHandler); from a dependency service at a later point in time but before a view with an ad is opened as a work around and MobileAds.SharedInstance is still null. Using the test app ID in info.p.
So it turns out SharedInstance is null when building from Visual Studios on windows. Not ideal but works fine when building from a mac
After update to the latest version the iOS app crashes when calling LoadApplication in FinishedLaunching
Error:
FinishedLaunching:
public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions) { global::Xamarin.Forms.Forms.Init(); Rg.Plugins.Popup.Popup.Init(); LoadApplication(new App()); MobileAds.SharedInstance.Start(CompletionHandler); Firebase.Core.App.Configure(); return base.FinishedLaunching(application, launchOptions); }
Info.plist entrys: