xamarin / GoogleApisForiOSComponents

MIT License
225 stars 161 forks source link

MobileAds.SharedInstance.Start(completionHandler: null) throws NRE #592

Open KrizCologne opened 1 year ago

KrizCologne commented 1 year ago

I try to implement MTAdMob to my Xamarin.iOS project, but when I try to call MobileAds.SharedInstance.Start(completionHandler: null)

I get following error:

13:44:00:044    [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) [0x00013] in C:\Users\CRoeder\source\repos\Privat\PLUTester\PLUTester\PLUTester.iOS\AppDelegate.cs:27 
13:44:00:044      at (wrapper managed-to-native) UIKit.UIApplication.xamarin_UIApplicationMain(int,string[],intptr,intptr,intptr&)
13:44:00:044      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:44:00:044      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:44:00:044      at PLUTester.iOS.Application.Main (System.String[] args) [0x00001] in C:\Users\CRoeder\source\repos\Privat\PLUTester\PLUTester\PLUTester.iOS\Main.cs:12 
13:44:00:044      at (wrapper managed-to-native) System.Reflection.RuntimeMethodInfo.InternalInvoke(System.Reflection.RuntimeMethodInfo,object,object[],System.Exception&)
13:44:00:044      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 '

When I set the breakpoint before the Start method, I see, that SharedInstance is null. Is there anything else, I have to init first?

DeerSteak commented 1 year ago

I just ran into the same thing. Exact same callstack.

steveoshima commented 11 months ago

Was this fixed? works fine for android, but iOS has this error on

MobileAds.SharedInstance.Start(CompletionHandler);