Cannot launch Xamarin.iOS app on device

2020-07-06 02:48发布

问题:

I am developing an iPad application with Xamarin.iOS and MVVMcross. So I have a PCL with my View-Model and my Model, and an iOS project with the view. I use Visual Studio.

Before, I used Xamarin.iOS 6.3.6 beta version, and when I tried to launch the app on the device, an .app file was created and getting it with my Ipad, I could launch the application (impossible to launch directly from Visual Studio).

Yesterday, I uploaded Xamarin.iOS to 6.4.1. On simulator, everything's okay. When I try to launch the application on device, now the app is directly installed but the build stop and the following error appear in the debug output :

Failed to load AOT module '<my PCL>' while running in aot-only mode: doesn't match assembly. 

And if I click on my app icon on the device,a black screen appear and disappear immediately.

Does someone know why this error appear?

回答1:

This looks like something was cached somewhere or not updated correctly.

Here are a few ideas to try:

  • Delete the app from the device.
  • Clean & Rebuild your app.
  • Build & install from Xamarin Studio on your Mac.
  • Copy the Debug configuration to a new configuration (DebugTest for instance), and run that configuration instead.


回答2:

I regularly get the same issue here.

The workaround that I use is to switch the platform in the Visual Studio build Configuration Manager to "iPhoneSimulator", run a quick debug session on that, then switch the platform back to "iPhone", and the problem disappears for a while.

Unfortunately I have no intelligent reason as to why this works. It seems to be doing a better job of the "Clean and Rebuild".



回答3:

After reading a similar bug, I found that clearing the mtbs folder on the OS X host which is located at $HOME/Library/Caches/Xamarin/mtbs/ fixes this problem for me.

I have to do it so frequently I just have a PuTTY session open on my Windows box to clear the folder. I do hope that Xamarin fixes this issue soon.



回答4:

Make sure Linker Behaviour is set to Don't Link

Clean, rebuild, remove old version from app.

Worked for me at least.



回答5:

This happened to me after I upgraded to XCode 5/iOS7. I noticed a warning that I hadn't installed XCode Command Line Tools. After I did that I rebuilt the application and it now runs.



回答6:

I just had this problem and got it to work again by opening the Apple project properties and changing the provisioning profile identity from "Distribution" to "Developer".



回答7:

My workaround on Mac is to

  1. Close Solution in XS
  2. Quit XS. Command-Q
  3. Reopen it and reopen solution.

After that it usually works again.