我正在尝试为unity3d开发一个windows phone插件来显示admob广告。我是Windows Phone的新手。我按照here的步骤进行操作。我的windows phone类库类代码是:
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using GoogleAds;
namespace UnityPluginForWindowsPhone
{
/**
* this class belongs to windows phone class library.
**/
public class TAdmob
{
private static string interstitialAdUnitId;
private static InterstitialAd interstitialAd;
public static void InitInterstitialAd(string adUnitId)
{
interstitialAdUnitId = adUnitId;
interstitialAd = new InterstitialAd(adUnitId);
}
public static void ShowInterstitialAd()
{
AdRequest adRequest = new AdRequest();
interstitialAd.ReceivedAd += OnInterstitialAdRecieved;
interstitialAd.LoadAd(adRequest);
}
private static void OnInterstitialAdRecieved(object sender, AdEventArgs e)
{
interstitialAd.ShowAd();
}
public static string GetString()
{
return "Hello, Not a device";
}
}
}
我的windows类库类是:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace UnityPluginForWindowsPhone
{
/**
* this class belongs to windows class library which is used for the unity editor.
**/
public class TAdmob
{
public static void InitInterstitialAd(string adUnitId)
{
}
public static void ShowInterstitialAd()
{
}
}
}
我在日志中收到以下消息:
'TaskHost.exe' (CoreCLR: DefaultDomain): Loaded 'C:\windows\system32\mscorlib.ni.dll'. Cannot find or open the PDB file.
'TaskHost.exe' (CoreCLR: Silverlight AppDomain): Loaded 'C:\windows\system32\System.Windows.RuntimeHost.ni.dll'. Cannot find or open the PDB file.
'TaskHost.exe' (CoreCLR: Silverlight AppDomain): Loaded 'C:\windows\system32\System.Windows.ni.dll'. Cannot find or open the PDB file.
'TaskHost.exe' (CoreCLR: Silverlight AppDomain): Loaded 'C:\windows\system32\System.Net.ni.dll'. Cannot find or open the PDB file.
'TaskHost.exe' (CoreCLR: Silverlight AppDomain): Loaded 'C:\windows\system32\System.ni.dll'. Cannot find or open the PDB file.
'TaskHost.exe' (CoreCLR: Silverlight AppDomain): Loaded 'C:\windows\system32\System.Xml.ni.dll'. Cannot find or open the PDB file.
'TaskHost.exe' (CoreCLR: Silverlight AppDomain): Loaded 'C:\Data\Programs\{857FF137-25B1-462A-BC86-829A1236A776}\Install\UnityPluginTestForWindowsPhone.DLL'. Symbols loaded.
'TaskHost.exe' (CoreCLR: Silverlight AppDomain): Loaded 'C:\windows\system32\Microsoft.Phone.ni.dll'. Cannot find or open the PDB file.
'TaskHost.exe' (CoreCLR: Silverlight AppDomain): Loaded 'C:\windows\system32\Microsoft.Phone.Interop.ni.dll'. Cannot find or open the PDB file.
'TaskHost.exe' (CoreCLR: Silverlight AppDomain): Loaded 'C:\Data\Programs\{857FF137-25B1-462A-BC86-829A1236A776}\Install\WinRTBridge.DLL'. Cannot find or open the PDB file.
'TaskHost.exe' (CoreCLR: Silverlight AppDomain): Loaded 'C:\Data\Programs\{857FF137-25B1-462A-BC86-829A1236A776}\Install\BridgeInterface.winmd'. Module was built without symbols.
'TaskHost.exe' (CoreCLR: Silverlight AppDomain): Loaded 'C:\Data\Programs\{857FF137-25B1-462A-BC86-829A1236A776}\Install\UnityPlayer.winmd'. Module was built without symbols.
'TaskHost.exe' (CoreCLR: Silverlight AppDomain): Loaded 'C:\windows\system32\WinMetadata\Windows.winmd'. Cannot find or open the PDB file.
'TaskHost.exe' (CoreCLR: Silverlight AppDomain): Loaded 'C:\windows\system32\System.Runtime.ni.dll'. Cannot find or open the PDB file.
'TaskHost.exe' (CoreCLR: Silverlight AppDomain): Loaded 'C:\windows\system32\System.Core.ni.dll'. Cannot find or open the PDB file.
Build from '' branch, version is '4.3.4f1 (e444f76e01cd)' (Release build).
Physical memory: 907 MB, commited memory limit: 380 MB.
PlayerConnection initialized from C:/Data/Programs/{857FF137-25B1-462A-BC86-829A1236A776}/Install/Data (debug = 0)
PlayerConnection initialized network socket : 0.0.0.0 55344
Multi-casting "[IP] 192.168.0.114 [Port] 55344 [Flags] 2 [Guid] 352403036 [EditorId] 599262348 [Version] 1048832 [Id] WP8Player(192.168.0.114) [Debug] 0" to [225.0.0.222:54997]...
Direct3D:
Version: Direct3D 11.0 [level 9.3]
Renderer: Qualcomm Adreno 305 (WDDM v1.2) (ID=0x30303330)
Vendor: Qualcomm
VRAM: 98 MB
Initialize engine version: 4.3.4f1 (e444f76e01cd)
'TaskHost.exe' (CoreCLR: Silverlight AppDomain): Loaded 'C:\Data\Programs\{857FF137-25B1-462A-BC86-829A1236A776}\Install\UnityEngine.DLL'. Cannot find or open the PDB file.
'TaskHost.exe' (CoreCLR: Silverlight AppDomain): Loaded 'C:\Data\Programs\{857FF137-25B1-462A-BC86-829A1236A776}\Install\UnityEngineProxy.DLL'. Cannot find or open the PDB file.
'TaskHost.exe' (CoreCLR: Silverlight AppDomain): Loaded 'C:\Data\Programs\{857FF137-25B1-462A-BC86-829A1236A776}\Install\Assembly-CSharp.DLL'. Symbols loaded.
'TaskHost.exe' (CoreCLR: Silverlight AppDomain): Loaded 'C:\Data\Programs\{857FF137-25B1-462A-BC86-829A1236A776}\Install\GoogleAds.DLL'. Symbols loaded.
'TaskHost.exe' (CoreCLR: Silverlight AppDomain): Loaded 'C:\Data\Programs\{857FF137-25B1-462A-BC86-829A1236A776}\Install\UnityPluginForWindowsPhone.DLL'. Symbols loaded.
'TaskHost.exe' (CoreCLR: Silverlight AppDomain): Loaded 'Anonymously Hosted DynamicMethods Assembly'.
'TaskHost.exe' (CoreCLR: Silverlight AppDomain): Loaded 'C:\Data\Programs\{857FF137-25B1-462A-BC86-829A1236A776}\Install\UnityEngineDelegates.winmd'. Module was built without symbols.
'TaskHost.exe' (CoreCLR: Silverlight AppDomain): Loaded 'C:\windows\system32\System.Runtime.InteropServices.WindowsRuntime.ni.dll'. Cannot find or open the PDB file.
'TaskHost.exe' (CoreCLR: Silverlight AppDomain): Loaded 'C:\windows\system32\en-US\mscorlib.debug.resources.dll'. Module was built without symbols.
A first chance exception of type 'System.UnauthorizedAccessException' occurred in Microsoft.Phone.ni.dll
'TaskHost.exe' (CoreCLR: Silverlight AppDomain): Loaded 'C:\windows\system32\System.Runtime.Serialization.ni.dll'. Cannot find or open the PDB file.
A first chance exception of type 'System.IO.FileNotFoundException' occurred in mscorlib.ni.dll
A first chance exception of type 'System.UnauthorizedAccessException' occurred in System.Windows.ni.dll
Exception: Invalid cross-thread access.
Type: System.UnauthorizedAccessException
Module: System.Windows
InnerException: <No Data>
AdditionalInfo:Invoking AdButton::OnMouseUpAsButton method with argument count: 0
at MS.Internal.XcpImports.CheckThread()
at MS.Internal.XcpImports.MessageBox_ShowCore(String messageBoxText, String caption, UInt32 type)
at System.Windows.MessageBox.ShowCore(String messageBoxText, String caption, MessageBoxButton button)
at System.Windows.MessageBox.Show(String messageBoxText)
at UnityPluginForWindowsPhone.TAdmob.ShowInterstitialAd()
at AdButton.OnMouseUpAsButton()
at lambda_method(Closure , Object , Object[] , Int32 )
at WinRTBridge.MethodTools.InvokeMethod(Object instance, Int32 methodIndex, Object[] args)
(Filename: C:/BuildAgent/work/d3d49558e4d408f4/Runtime/Scripting/WinRTUtility.cpp Line: 65)
我试图找到无法使用Process Monitor访问的文件,并找到了这个。虽然无法找到它的含义。输出屏幕截图如下:
我无法弄清楚该怎么做。有谁知道如何解决这个问题?
答案 0 :(得分:0)
确保您已选中以下权限:&#34; ID_CAP_NETWORKING,ID_CAP_WEBBROWSERCOMPONENT,ID_CAP_MEDIALIB_PLAYBACK和ID_CAP_MEDIALIB_AUDIO&#34;