简体   繁体   中英

WP7 AdMob SDK doesn't Work

I always get an error when I start an app with an AdMob BannerAd. I just added the control to the toolbox and copy pasted in in the form.

Here is the relevant code:

<my:BannerAd HorizontalAlignment="Left" Margin="0,522,0,0" Name="bannerAd1" VerticalAlignment="Top" />

When I run the app I get this error:

System.NullReferenceException wurde nicht behandelt.
  Message=NullReferenceException
  StackTrace:
    bei Google.AdMob.Ads.WindowsPhone7.WPF.DisplayAdBase.<>c__DisplayClass3c.<LoadDisplay>b__38()
    bei System.Reflection.RuntimeMethodInfo.InternalInvoke(RuntimeMethodInfo rtmi, Object obj, BindingFlags invokeAttr, Binder binder, Object parameters, CultureInfo culture, Boolean isBinderDefault, Assembly caller, Boolean verifyAccess, StackCrawlMark& stackMark)
    bei System.Reflection.RuntimeMethodInfo.InternalInvoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, StackCrawlMark& stackMark)
    bei System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)
    bei System.Delegate.DynamicInvokeOne(Object[] args)
    bei System.MulticastDelegate.DynamicInvokeImpl(Object[] args)
    bei System.Delegate.DynamicInvoke(Object[] args)
    bei System.Windows.Threading.DispatcherOperation.Invoke()
    bei System.Windows.Threading.Dispatcher.Dispatch(DispatcherPriority priority)
    bei System.Windows.Threading.Dispatcher.OnInvoke(Object context)
    bei System.Windows.Hosting.CallbackCookie.Invoke(Object[] args)
    bei System.Windows.Hosting.DelegateWrapper.InternalInvoke(Object[] args)
    bei System.Windows.RuntimeHost.ManagedHost.InvokeDelegate(IntPtr pHandle, Int32 nParamCount, ScriptParam[] pParams, ScriptParam& pResult)

Im using http://wp7adrotator.codeplex.com/ . Having no problems still on my app. http://www.aldarit.com/superads.html is a good solution too. Used it before started using wp7adrotator. You might give it a try too.

Hope it helps.

I'm using AldarIT SuperAds for three production Apps with AdMob as primary ad provider. No problems so far after 5 Months.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM