How to launch a xamarin app on iOS simulator from windows? - ios

I have build a xamarin app and tested it on android emulator and the app works fine. I've decided to test it on iOS simulator, but it is not going as planed. I've connected my windows pc to the MacBook Pro, updated Visual Studio 2019 and xCode to the latest version and set the Automatic Provisioning. When I try to launch the app on ios 14.5 version of no importance which iPhone, I get this error:
error HE0046: Failed to install the app 'packageName' on the device 'iOS 14.5 (18E182) - iPhone 12': ???appName??? Needs To Be Updated
I've google it with no success. I've tried to launch the app on older iOS version, but I get another error:
error HE0042: Could not launch the app 'packageName' on the device 'iOS 13.0 (17A577) - iPhone 8': The request to open "appName" failed.
I've checked the logs on the macBook simulator, but I still can't solve my issue.
Logs from iPhone 8 iOS 13.0 simulator:
Jul 1 16:02:11 Borjans-MBP com.apple.CoreSimulator.SimDevice.7E33AFBE-858C-4EBD-9470-8E503EAA0B21[18503] (UIKitApplication:packageName[82f8][rb-legacy][38282]): Could not find and/or execute program specified by service: 86: Bad CPU type in executable: /Users/borjan/Library/Developer/CoreSimulator/Devices/7E33AFBE-858C-4EBD-9470-8E503EAA0B21/data/Containers/Bundle/Application/B178901C-355F-4956-9EA0-296A2CEB1718/projectName.iOS.app/projectName.iOS
Jul 1 16:02:11 Borjans-MBP com.apple.CoreSimulator.SimDevice.7E33AFBE-858C-4EBD-9470-8E503EAA0B21[18503] (UIKitApplication:bundleName[82f8][rb-legacy][38282]): Service setup event to handle failure and will not launch until it fires.
Jul 1 16:02:11 Borjans-MBP com.apple.CoreSimulator.SimDevice.7E33AFBE-858C-4EBD-9470-8E503EAA0B21[18503] (UIKitApplication:bundleName[82f8][rb-legacy][38282]): Service exited with abnormal code: 78
Jul 1 16:02:59 Borjans-MBP syslogd[18505]: ASL Sender Statistics
I've spend a few days looking for solution but I didn't find one. Can someone please help me?

I've finally found what was the issue. It somehow the configuration changes from iPhoneSimulator to iPhone when I am clicking the run button. I should manually set the configuration to iPhoneSimulator and it works now. Just go to Configuration Manager, find the iOS project and set the platform to iPhoneSimulator instead of iPhone.

Related

Failed to prepare device for development error when deploying app

I am trying to run my app on a physical device. The applicaiton builds but it doesnt deploy my app to the device.
I get this following error:
This operation can fail if the version of the OS on the device is incompatible with the installed version of Xcode. You may also need to restart your mac and device in order to correctly detect compatibility.
Details:
I have xcode version 13.2.1
device is iphone 11 pro max with ios version 15.6 installed.
I tried to upgrade my xcode to 13.4.1 but on app store there is no button that indicates that i can upgrade.
Things I have tried:
restarting mac
restarting iphone device
closing and reopening xcode
cleaning project and rebuilding.
Any help will be appreciated.
Download xCode 13.4.1 directly using the link
https://download.developer.apple.com/Developer_Tools/Xcode_13.4.1/Xcode_13.4.1.xip

Why does my Xamarin Forms iOS app fail to open in release mode when launched from Visual Studio?

I can launch it by clicking the app on the iPhone simulator itself, and have no issues launching from Visual Studio in debug mode.
Errors: 0, warnings: 0.
The message in my Application output reads:
error HE0042: Could not launch the app [appName] on the device 'iOS
14.2 (18B79) - iPhone 12 mini': The request to open [app] failed.
My simulator’s system.log reads:
com.apple.CoreSimulator.SimDevice.E4CA5C26-862D-4D54-8692-6E6C097A3877[1192]
(UIKitApplication:com.fern.app[1e6f][rb-legacy][1424]): Service could
not initialize: 20B50: xpcproxy_sim + 10650
[839][24AD6C58-C8BA-3A6E-94A2-DBC1AB4FF4B2]: 0x1 Dec 4 17:11:36
Ferns-iMac syslogd[1194]: ASL Sender Statistics Dec 4 17:11:36
Ferns-iMac
com.apple.CoreSimulator.SimDevice.E4CA5C26-862D-4D54-8692-6E6C097A3877[1192]
(UIKitApplication:com.fern.app[1e6f][rb-legacy][1424]): Service exited
with abnormal code: 78
Here’s what I’ve tried without any luck:
Selecting the simulator -> Device -> Erase all content and settings.
Updating all Nuget packages.
Reinstalling Visual Studio 2019 for Mac, 8.9 build 265.
Reinstalling Xcode 12.2.
Reinstalling .NET Core SDK 3.1.403.
Made sure my provisioning profiles are valid.
Asked a colleague to run the same solution and he got the same problem.
Thanks for any help!

Xcode will run the Unity app on device, but when I run the built app, the black screen will appear

environment:
Develop OS:macOS Catalina 10.15.5
Xcode:11.5
Device OS: iPhone 7 Plus (iOS 13.5.1)
Unity : 2019.3.9f
I built the iOS app with Unity.
When I play on the Running on device on Xcode, the app works normally.
However, when I turn off the Xcode and turn on the built app, the black screen comes out and stops.
If I run it on the simulator to check the log, the following log occurs.
Could not find and/or execute program specified by service: 86: Bad CPU type in executable: /Users/develop/Library/Developer/CoreSimulator/Devices/31985C61-CACF-40D6-8A48-A2BA2BAF0DDD/data/Containers/Bundle/Application/EC20344C-A067-4379-A9EA-CE0E42F3C106/make.app/make
Service setup event to handle failure and will not launch until it fires.
Service exited with abnormal code: 78
But when I play on the Running on device on Xcode, I can't understand the app running normally.
I tried the Unity version 2018 to figure out the problem, but it works well. However, when I upgraded the Unity version to 2019, the above problem occurs.
I want to know the causes and solutions of these problems in Unity 2019.
On Xcode
Go to Unity-iPhone - Build Phases - Link Binary with Libraries build section
Add UnityFramework.framework
This happens on Unity 2019/2020

Visual Studio 2017 (Xamarin) not showing list of iPhone Simulators

I've got everything seemingly working properly with the connection between my VS 2017 and the Mac. All looks good as far as the connection, the build works fine with no errors but I can't actually debug/run it because it doesn't allow me to choose a simulator.
On the toolbar, I have selected: Debug | iPhoneSimulator | Simulator
iPhoneSimulator is the ACTIVE platform.
On the Start > button when I drop down the menu options, it gives me:
Start
Device
Unsupported Devices >
Change Deployment Target
iPhone 5s iOS 10.2
iPhone 6 Plus 10.2
iPhone 6s Plus iOS 10.2
iPhone 6 iOS 10.2
See the screenshot of my menu options
and about 10 or so more but they are all in the "unsupported" category so whenever I try to click on one, nothing happens, and when I try to run my project, I get "Please select a valid device before running the application."
The PC is running Windows 10 x64 with Visual Studio 2017 Community Edition.
The MAC is running El Capitan 10.11.6. (Can't update to Sierra (10.12+) because Apple doesn't support it on this MAC)
Xcode running is 8.2 (have also tried 8.2.1) and can't update to 8.3+ because 8.3 and up requires Sierra (o/s 10.12+)
The latest versions of Xamarin are installed on both the PC and the MAC with all corresponding updates.
I've had to change the build option "Link Behavior" in VS to "Link Framework SDK Only" as the instructions state because of the fact that I can't install Xcode 8.3 on the MAC.
Any suggestions as to why everything would seem to work EXCEPT for VS 2017 no obtaining a list of simulators from the MAC? The MAC sees the simulators. Even running the command "xcrun instruments -s devices" on the MAC returns all of the simulators. I can make a sample program in Xcode, choose a simulator and run it. It just won't pass that information to my VS 2017 so that I can launch it from there. It will even let me launch the iOS simulator from VS 2017 without error.
I've tried uninstalling and re-installing Xamarin on both the PC and MAC and creating a new iOS project. Everything builds fine. Everything else works, just not the debugging/running and the reason it won't work is because I can't choose an actual emulator.
You will need to make sure your target version is lower than your Simulator version.
Open Info.plist and select a version lower or equal to 10.2.
I ran into something similar while running VS2017 on Mac OS X. I was using multiple build configurations, and I had multiple Info.plist files. One of them (not even the one that should have been used for that build config) had two entries for CFBundleShortVersionString due to a bad git merge. I wouldn't have discovered that if I wasn't opening each of them to change the Deployment Target mentioned in #lowleetak's answer. After correcting that, I was able to debug to the simulator again.
So for other who run into this - check your Info.plist files.

visual studio 2017 cordova ios debug in local device failed

This is link of the same problem I raised in Visual Studio Developer support portal.
https://developercommunity.visualstudio.com/content/problem/61875/visual-studio-2017-cordova-ios-debug-on-local-devi.html
I am trying to debug cordova app in iPhone 5s local device connected to my laptop.
visual studio 2017 cordova 7.0.1 xcode 8.3.1 ios 10.2.1
After build it is failing at deployment.
build successful but failing to deploy to IOS device.
it is bringing up itunes and then shows the app there and device is identified but says error occured continue or not? and fails.
Earlier I deployed and several times debugged directly with local device.
one error result states, version mismatch other says device may not be connected and awake.
I am using ipod 9.3 version ios and another one iphone 5s with 10.2.1 ios.
I am building apache cordova app in visual studio 2017 with macincloud remotebuild.
how to resolve this!? any hint is a big help!!
I am manually deploying but can't debug. now,
i am getting network error at xmlhttprequest in device and but same code working fine in simulator.
when press device button then and i restart app then it is dumping a big error message and showing exitapp though i am not using any of that plugin or code line.
how to debug on device is first priority which may help to resolve rest.
1>Time Elapsed 00:05:02.04 2>------ Deploy started: Project: BlankCordovaApp2, Configuration: Debug iOS ------ 2>Found iTunes version: 12.3.2.35 2>Uninstalling app ID: COM.appanem.appanem. 2>Successfully installed .ipa file: C:\Users\Ekambarrao\documents\visual studio 2017\Projects\BlankCordovaApp2\BlankCordovaApp2\bin\iOS\Debug\appanem.ipa. 2>Starting idevicedebugserverproxy.exe at port 3000. 2>Cannot find the app installed on the device. Check that the device is connected, awake, and unlocked. 2>Starting ios_webkit_debug_proxy.exe at port 9221. 2>Deployment failed.
Is everybody happily working with this latest releases of Cordova IOS xcode vs 2017 or everybody facing the same problem as I am?
Issue is resolved, I am able to debug after I built my own VM of IOS and then debug but not sure what really resolved this.
What I can make out is,
unlike earlier, (not sure correct or wrong because this I could not do when I was using macincloud),
now the provisional profile need to be tagged to even device for debugging which was earlier sufficient to just list the device uuid in store certificates and profiles section.

Resources