Admob WP8 System.UnauthorizedAccessException

心不动则不痛 提交于 2020-01-04 06:35:15

问题


I am developing a WP8 app using VS2012. I wish to add Admob banner ads, unfortunately it is raising an exception which is causing my app to freeze. To catch this admob exception, I had to disable 'Just my code' VS2012 setting, and after executing the following code, I get a 'System.UnauthorizedAccessException: Access is denied' at the last line.

_adControl = new AdView
{
    Format = AdFormats.SmartBanner,
    AdUnitID = "ca-app-pub-31231-FAKE-FAKE-FAKE"
};

_adControl.VerticalAlignment = VerticalAlignment.Top;
_adControl.FailedToReceiveAd += AdControlOnErrorOccurred;
AdRequest adRequest = new AdRequest();
GamePage.LayoutGrid.Children.Add(_adControl);
_adControl.LoadAd(adRequest);

If I enable the 'ID_CAP_IDENTITY_DEVICE' and 'ID_CAP_IDENTITY_USER', Which the Google docs state are not required, I start receiving a 'System.Exception' instead of 'System.UnauthorizedAccessException'. I can not figure out how this can be fixed, if it is even possible.

来源:https://stackoverflow.com/questions/24097908/admob-wp8-system-unauthorizedaccessexception

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!