xamarin build pass on simulator but fails on real device

故事扮演 提交于 2019-12-24 11:21:16

问题


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

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