Forum Xamarin Xamarin.iOS

Cannot run iOS app on a device

awerberawerber Member ✭✭✭

My project runs fine on the Apple Simulator, but when I attach my iPod Touch (iOS 9), I get errors. I have been trying to get past errors in a rather haphazard way and have gotten past quite a few, but I don't see anything helpful when I do a Google search on the various output items that look like they may be a problem. Also, I have not tried to make a simple iOS app and tried to run it on my iPod.

Here's the build error I get:

Could not link assemblies. Reason: Error while processing references of 'TestXamarinFormsProject.iOS, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' RodneyPix.iOS

There are also a few warnings:

Warning The app icon set "AppIcon" has 13 unassigned children. RodneyPix.iOS
Warning The app icon set "AppIcons" has 32 unassigned children. RodneyPix.iOS
Warning Cannot find the assembly 'Java.Interop, Version=0.1.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065' referenced from '/Users/andrewwerber/Library/Caches/Xamarin/mtbs/builds/RodneyPix.iOS/da20d03a7a413827de12ab67546223a2/bin/iPhone/Debug/Mono.Android.dll'. RodneyPix.iOS
Warning The app icon set "AppIcons" has 32 unassigned children. RodneyPix.iOS

I saved output from the various Output windows, but I don't want to post all that stuff here since there's so much of it and may not be useful. I also do not want to display anything that might pose a security problem.

Lastly, I do development using Visual Studio 2019 Community Edition for Windows, and have a Mac mini with Catalina and XCode 11.3 on it.

Any clue on how to proceed or analyze the problem would be greatly appreciated.

Best Answer

  • awerberawerber Member ✭✭✭
    Accepted Answer

    I got a refurbished iPad Mini with an A7 chip and upgraded the OS to 12.4.4 and got the same error. Then I opened the Device Log in Visual Studio. When I ran the project, it was deployed to the iPad! Then I closed the Device Log and it still ran. Weird. I'll have to test my old iPod soon.

Answers

  • LandLuLandLu Member, Xamarin Team Xamurai

    Warning The app icon set "AppIcons" has 32 unassigned children. RodneyPix.iOS

    Open the Assets file in the Asset Catalog. You will find the AppIcon image asset and we have to fill all the icons there. Here is my file:

    Warning Cannot find the assembly 'Java.Interop, Version=0.1.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065' referenced from

    Have you referenced Mono.Android dll or other Android libraries in your iOS project?
    However, these are all warnings. They won't stop you from deploying projects on the device. Are you aware that if we want to deploy on a real device we need a provisioning profile? Read this documentation for more details: https://docs.microsoft.com/en-us/xamarin/ios/get-started/installation/device-provisioning/free-provisioning?tabs=windows
    If all probabilities have been excluded do you have another device for testing? iPod with iOS 9 is an old device, I'm not sure whether issues are coming from it.
    The last attempt could be testing a new blank project to see the result.

  • awerberawerber Member ✭✭✭

    @LandLu, thank you for taking the time to address my question. Sorry for taking so long to get back, but I've been really busy with other things.

    I created a new iOS project in VS2019 and followed the instructions, as best I could, in the page about setting up provisioning. The project compiled, but I did not see anything on my iPod Touch. When I run an Android project, I can see the app working on my phone. But, in the case of the Android, I have to set some options in order to see the app. Do I have to change some settings on my iPod Touch in order to see the app on the device? I should note that the default app ran fine on the Simulator.

  • LandLuLandLu Member, Xamarin Team Xamurai

    If we set up correctly with the provisioning profile nothing needs to be set on the iPod. Any project that has the correct provisioning profile could be deployed on the device.
    Try to deploy a blank project on your iPod with XCode to see whether it will work.

  • awerberawerber Member ✭✭✭

    @LandLu, thank you again for taking the time to address my question.

    Are you asking me to create a project with XCode and deploy it to my iPod? If so, I'll have to find instructions on how to do that, I'm totally inexperienced developing on a Mac, I've only worked with Visual Studio on Windows machines.

  • awerberawerber Member ✭✭✭

    OK, I created a blank app in XCode and it showed up on my iPod Touch. But, what do I do now?

  • awerberawerber Member ✭✭✭

    I am getting some errors when trying to launch:

    From the Debug option of the Output window:

    Launch failed. The app 'RodneyPix.iOS' could not be launched on 'Andrew's iPod touch'. Error: error MT1006: Could not install the application '/Users/xxxxx/Library/Caches/Xamarin/mtbs/builds/RodneyPix.iOS/da20d03a7a413827de12ab67546223a2/bin/iPhone/Debug/TestXamarinFormsProject.iOS.app' on the device 'Andrew's iPod touch': AMDeviceSecureInstallApplicationBundle returned: 0xe8000087 (kAMDIncorrectArchitectureError).. Please check the logs for more details.

    From the Build option of the Output window:

    IncorrectArchitecture: Failed to find matching arch for 64-bit Mach-O input file /private/var/installd/Library/Caches/com.apple.mobile.installd.staging/temp.E5gQOE/extracted/TestXamarinFormsProject.iOS.app/TestXamarinFormsProject.iOS

    I did a bit of searching on these and turned up one Forum page, https://forums.xamarin.com/discussion/129706/can-deploy-to-iphone-but-not-ipad-0xe8000087-kamdincorrectarchitectureerror, where the person said they had to change to 'ARMv7 + ARMv7s + ARM64'. I looked at the file in XCode for my project, and it has those architectures set. I don't see a way to set these in Visual Studio.

    Any help on getting past this would be greatly appreciated.

  • LandLuLandLu Member, Xamarin Team Xamurai

    Ah, I even forgot the iPod is built with 32-bit architecture as it is really an old device.
    Here are the steps for how we could change the supported architecture in VS.
    Firstly, change the minimum iOS version in info.plist:

    Then we could change the supported architecture. Right-click the project => Properties => iOS Build => Change platform to iPhone:

  • awerberawerber Member ✭✭✭

    @LandLu, thank you again for taking the time to respond to my problem, but I get the same errors as before. This occurs with the VS 2019 project, which uses all default values to start with, then I made the changes you suggested.

  • LandLuLandLu Member, Xamarin Team Xamurai

    Did you mean this mismatch architecture issue still occurs after you change the setting to ARMv7 + ARMv7s + ARM64?
    I don't have a 32-bit beside to test this however, it should work after that setup.
    Do you have other 64-bit devices to test this? Apple has rejected publishing 32-bit applications to App Store so I think it's the time to use 64-bit to debug the effect of your application.

  • awerberawerber Member ✭✭✭

    @LandLu, yes, I get the same architecture error after setting the supported architectures in Visual Studio to ARMv7 +ARMv7s + ARM64. I don't have any Apple 64 bit devices.

    I also set the architectures in the corresponding .xcodeproj files to the same architectures.

    I did see one interesting thing. I added a label to my otherwise blank Xcode project. I was getting an error trying to run that project using my iPod as the output device. I was able to fix this problem by add the line

    @property (strong, nonatomic) UIWindow *window;
    

    to the appdelegate class. Could this be some kind of clue as to how I could get my app to run on my iPod?

    Also, as my goal is to get my app on the iTunes store, can I make a file and copy it to my iPod? I can do that with my Android project - I make an APK file, copy it to my phone and tap on it. I would like to be able to run my app on my iPod so I can see it on a real device, not just the Simulator.

  • LandLuLandLu Member, Xamarin Team Xamurai

    iOS 13 announces new technology for displaying multiple windows so we need to add this property for iOS 13-. However, Xamarin iOS with the latest version has helped us fix it by adding:

    [Export("window")]
    public UIWindow Window { get; set; }
    

    So does Xamarin Forms.

    Also, as my goal is to get my app on the iTunes store, can I make a file and copy it to my iPod?

    If you can't debug your project on the iPod neither can ipa. And you could try App Center: https://appcenter.ms/apps. It helps you deploy applications on real devices.

  • awerberawerber Member ✭✭✭
    Accepted Answer

    I got a refurbished iPad Mini with an A7 chip and upgraded the OS to 12.4.4 and got the same error. Then I opened the Device Log in Visual Studio. When I ran the project, it was deployed to the iPad! Then I closed the Device Log and it still ran. Weird. I'll have to test my old iPod soon.

Sign In or Register to comment.