问题
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