问题
I am creating an app using xamarin to be cross plateform. My android version works well on a simulator and a real device. The ios version works only in the simulator. When I try to debug on a real device I get this error
Error MT2002: Failed to resolve "System.Reflection.Emit.DynamicMethod" reference from "mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" (MT2002)
with noting more...
回答1:
Check the Xamarin.iOS limitations: http://developer.xamarin.com/guides/ios/advanced_topics/limitations/
Since the iPhone's kernel prevents an application from generating code dynamically Mono on the iPhone does not support any form of dynamic code generation.
These include: The System.Reflection.Emit is not available.
回答2:
Actually the issue appeared, since I added reference to WebSocket4Net in my PCL project. As the android app was still working, and also the Iphone simulator, I assumed that everything was ok.
I figured out that there are specific binaries or WebSocket4Net for Android and Ios. So I simply added reference to the WebSocket4Net nuget package in the IOS project, and the app works now on my device also.
Thank you for you help and answers.
来源:https://stackoverflow.com/questions/26225730/xamarin-build-pass-on-simulator-but-fails-on-real-device