Xcode app won't launch on ipod the first time I run, but will run the second time (no clean/build) - ios

I have an iOS app that I've had to rename (kept the bundle id the same, but renamed practically everything else), and now I can't get it to run on my development iPod during the initial launch from Xcode. I'm worried that this means existing users will have a broken app if I submit it now.
Here's the process:
No app on device.
Clean
Build
Run on target device.
Runs as expected
Current app on device, downloaded from app store.
Clean
Build
Run on target device.
Fails with error: "Could not launch app name. Failed to get the task for process pid"
Attempting to launch to the app from the device shows the app-launch ("zoom") animation, but immediately closes.
But if I hit run in Xcode again (without cleaning or building) to cause a redownload of the app files, the app will run as expected on the iPod.
My question, then: Because the renamed app runs with a clean install, and runs after a "double launch" with the old app, can I expect this to work as an update? Or does the failed launch with the old app on the device mean the existing installs will just crash all the time? If so, any tips on how to fix this?
(Previous questions indicate that cleaning or deleting the DerivedData folder can fix the issue. I have tried both of these steps, but they haven't resolved anything.)

Attempts to debug an iOS app that has been signed with a Distribution provisioning key will fail with the "Could not launch app name. Failed to get the task for process pid" error because the app doesn't have the get-task-allow entitlement. It sounds like on first run either Xcode has not installed your rebuilt app over the downloaded app or Xcode has signed the app with the wrong key.
It's likely that your app will work correctly as an update.
(I'm sorry for adding this as an answer, but I don't have enough reputation to add a comment to your question.)

Related

Xcode fails to properly sign framework when debugging iOS app on a device

I'm running into an annoying problem that I'm hoping someone can shed some light on. We have an iOS framework that is built outside of Xcode and is embedded in our iOS app. Running (debugging) the app via Xcode (9.4) works great on a simulator.
The problem is that when we run (debug) it on a device, the install fails with this error:
installd: 0x16f9eb000 +[MICodeSigningVerifier _validateSignatureAndCopyInfoForURL: withOptions: error: ]: 147: Failed to verify code signature of /private/ var/ installd/ Library/ Caches/ com.apple.mobile.installd.staging/ temp.BGuE4G/ extracted/ MyApp.app/ Frameworks/ MyFramework.framework : 0xe8008001 (An unknown error has occurred.)
If I change the app target's signing identity/profile to distribution/ad hoc and run (debug) it, then it installs just fine (but course, doesn't let you actually attach to the process since it was signed for distribution). Then if I change the identity/profile back to development (without rebuilding the framework) and run it again, then it launches on the device and the debugger attaches just fine.
I can then edit-build-debug the app as many times as I like and it works great on the device every time. But as soon as I rebuild the framework and then run the app, I get the error again and have to repeat the process of switching to distribution and back before I can debug it.
So it appears to me that Xcode isn't properly signing the framework each time I run it - I have to trigger the signing myself by switching to distribution and back to development any time the framework changes. I've tried cleaning the app's project and derived data after rebuilding the framework but I still get the error.
I'd appreciate any ideas on how to troubleshoot this further or simply how to avoid needing to change the signing settings every time we change the framework (which is very frequent).
Thanks!

App crash when launching from Xcode if app already installed on device through Testflight

I'm building an iOS app for which I have Testflight set up, but now I'm running into an interesting issue where I can't properly launch the app from Xcode anymore since I registered my device to test the app through Testflight.
When I try to launch the app from Xcode, it will build fine and even launch it on my phone. However, there will be no output in the console, and a few seconds later the app will crash on my phone and I get the following error message popup in Xcode:
process launch failed: failed to get the task for process 484
If I delete the app from my phone before trying to launch from Xcode, the same thing will happen and the Testflight orange dot will still show up next to the app name on the home screen.
I have tried to change the app's version and build number, but that had no effect. I have not yet tried to unregister my device to test the app through Testflight because I would like to find a good way that facilitates both.
One way I have found to circumvent this problem is create a different app target and run the app with that which seems to work -- but I'm wondering if there is an actual solution to this problem or a better way to work around it.
Thanks in advance.
Turns out Max was on the right track - if I manually specify a non-distribution provisioning profile it will work properly by overriding the Testflight version of the app (the orange dot disappears). Not sure why "automatic" wasn't doing that for me. Thank you!

iOS application Ad Hoc installation stuck due to wrong configuration

My application got stuck on installation due to wrong configuration on my iPhone with iOS 7. Provisioning profiles, certificates, devices everything seems ok.
I found an example of how to prepare a web page to provide a download link for your iOS application. I completed the necessary steps with one small mistake. The mistake was my appName.ipa and appName.plist was different.
As a result, the link was look like working but was installing 2 apps because of this difference. Real app finished installing but other clone that comes from the wrong .plis file never finished installing.
I'm able to install/remove application but this second clone cannot be removed even there is an (X) symbol in edit mode. When I press the (X) symbol for deleting it shows the Alert View but not deleting the clone even I press Delete or Cancel.
I tried to delete it but couldn't find a way. I currently don't have any issues installing/removing my application but it just stuck there. Is there anyone has the same problem before or any ideas?
Did you try with iPhone Configuration utility (Win) / iPhone Configuration Utility (Mac) ?
I realised the problem, it's about the Bundle Identifier difference. I created a new app with the ghost icon's bundle identifier and run it from XCode, so XCode overrode it and successfully installed the test app.

XCode builds app to iPad but debugging is not allowed

when I run my app on iPad it builds my app and then I got error:
"Could not launch 'AppName', timed out waiting for app to launch".
Though, after this error, app is working perfectly on device. I think that it's caused by some sort of setting "Debug is not allowed" or something like that.
I was having the same problem - Deleting derived data didn't work. In my case I found out that I was building the debug with an Ad Hoc provisioning profile.
Also you might try to Reset Content and Settings within your iOS Simulator or to open the XCode Organzier, navigate to your project and delete all Derived Data. Sometimes these actions help by your given problem.

iOS App crashes when deployed to device

I have an app which I deploy to a physical device. The build succeeds and the App gets installed. But right after the launch image I get the error failed to get the task for process 2284.
When I quit XCode and launch the application manually on the device it runs without problems.
The XCode console does not give me much valuable information (See Gist)
This gist shows what the console on the device recorded.
I figured out, that the problem occurs when I am debugging with a Distribution profile. When I create a non-Distribution provisioning profile for the App I can debug again.
I got this a few times and after rebooting the iPhone (and maybe your Mac as well) everything worked like before the trouble started.

Resources