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

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!

Related

Cannot run app on real Apple Watch

my configuration: Apple Watch (WatchOS 2.0.1), iPhone 5S (iOS 9.1) Xcode 7.1 on MacOS X El Capitan.
I can run my app on the iPhone just fine. However, when I try to run my app on the Apple Watch, it seems like it's not possible. What I see in the status bar is the usual steps
Building MyApp on Apple Watch
Installing to Apple Watch
Running MyApp on Apple Watch
And then, in less that a second, it shows
Finished Running MyApp on Apple Watch
As if I had just pressed the stop button in Xcode (but without my having pressed it at all). No error message or warning. It just stops.
As a result, I'm not able to debug my app on the Apple Watch to see the log messages, memory usage, etc.
Any ideas? Thanks in advance for your help!
When this happened to me, I fixed the issue by:
Making sure there are no problems with your Main.storyboard and it has an initial view controller.
Deleted app on phone
Rebooted phone
Rebooted watch
Quit xcode and rebooted mac
You could build the app to iPhone first, wait the watch app sync to watch. (Or you could sync it in companion by turn off and turn on the install switch manually)
Then keep the app running on watch, select Xcode->Debug->Attach to Process->XXXXX Extension(the name of your watch extension)
After a while you should be able to debug the watch app.
After restarting all my devices twice to no avail, here are some tips that sometimes solve the issue. (This whole thing is a headache.) I usually use the combination of these 3 things and it works 90% of the time.
Build for a simulator and then switch back to a real device again.
Switch the Info/Launch scheme setting to "Wait for the executable to be launched", run the project and then switch back to "Automatically".
Delete the Derived Data folder located under ~/Library/Developer/Xcode/DerivedData.
This drove me up the wall when starting out. I found 2 solutions:
Stop wasting time developing for Apple Watch
Found my XCode was disconnecting from my Apple ID. Went to XCode -> Preferences -> Accounts. And noticed "Your session expired, please log in." I could run to iPhone no problem with this error but on Apple Watch it would get stuck on "Running ... Apple Watch"

XCode 6.3.1 - lost connection to attached device frequently

When running my App, I'll get this occur 3 out of 4 attempts to run the app from xcode. Hitting enter & CMD-R will sometimes generate the error again, and sometimes (rarely) actually run & debug the code. This happens with both an iPhone 6 device (8.3) and a iPhone 5 device (8.2).
While it's not a show stopper, its adding to the development cycle time. Anyone out there suffering the same issue, or anyone have a solution?
I've had this happen both with and without a watch extension, but it is more pronounced when working on an App with a watch extension.
While Watch connections can be inconsistent, it seems that keeping the Watch on the charger while debugging is a noticeable improvement. That's been my experience along with others who have comment in the Apple Developer Forums.
So here's my ritual on a "quick" turnaround for build & runs:
Open your app on the Watch
Press and hold the button below the crown until the Power Off options appear
Release the button and press and hold again. This will terminate the running app.
Build & Run from Xcode
On the Debug Navigator it will hang 9/10 times at the "Waiting to Attach" screen
Help Xcode a little bit by tapping on your app icon from your Watch home screen to open it, Xcode will promptly attach.
Your new build is now running.
I really hope they fix this in the next Xcode update but this is how it's currently working for me.

Xcode 6 process launch failed: timed out trying to launch app

I can't debug my app because when I run it, Xcode gives me the error:
Process launch failed: timed out trying to launch app
In the device I see a black screen and after the error message the app starts.
How can I fix this?
I tried to change the code signing identity and the provisioning profile, and to refresh the provisioning profiles in the Xcode > Preferences > Accounts > Details tab.
I'm using Xcode Version 6.0.1 (6A317) with an iPad mini, running iOS 8.0 and a MacBook with OSX 10.9.4.
After this, if the iPad goes into sleep mode (the screen turns off) I can't wake it anymore; I have to do a soft reset.
You are using distribution provisioning profile rather than development profile. check this link
How to Fix:
I fix it with:
clean project (Product > Clean)
hard reset device (power button + home button)
delete app from device
close xcode
CLOSE ITUNES (itunes must be closed)
re-open Xcode and run!
I think that iTunes was the problem.
EDIT: 2017/02: Solution still Woks (Thanks to #SalGad for information).
I am using Xcode 6.2, running on iPhone 4 with iOS 7.1.2, the problems happen to me as well.
It turned out that the Project and Targets' Code Signing settings are different from each other! And that's what is causing the issue.
To solve the issue, you must make sure that their Code Signing settings is the same.
One more thing that may be a reason to launch timeout arising is that you have a lot of Provision Profiles on your device. I have about 100 of them, downloaded automatically by XCode from our team dev portal. So if your team have tons of apps and Provision Profiles, you better unlink your XCode from your Apple ID, to prevent automatic downloading for unwanted PPs. It significantly decreases app launching time.
To delete unwanted PPs from your device you have to go XCode - Window - Devices, select your device and click "Show provision profiles..." on the bottom context menu. Then you have to manually remove the profiles. Tip: use key sequences "down arrow" - "backspace", to ease the hand routine.
I had this but nothing previously posted seemed to work. This is what I did to fix the issue in Xcode 6.3.2:
Go to Product->Scheme->Edit Scheme...
Select the Run Scheme
Select the Info tab
Make sure the settings are as follows:
Build Configuration is set to "Debug"
Debug Executable is checked
Launch Automatically is checked
In my case I was using the development profile, but somehow, in Build Settings > Code Signing, the Provisioning Profile for Debug was empty.
But before setting it to "iOS Team Provisioning Profile", I had to reset my account since it said " is Not on Any Development teams"
- Xcode > Preferences > Accounts
- Remove my account (click "-")
- Add the account again
That fixed the problem
Note that if the app still manages to start on the device after Xcode displays this error, you can attach to the running process with Debug->Attach to Process.
This warning is shown when you try to run and debug your code directly in device but you are using distribution profile in your Build Settings.
To directly run the code in device and debug, you need to use development profile in your Build Settings of Xcode.
After setting the development profile, just reboot your device clean your Xcode project and run again.
I hope this helps !!
An app should return from his initialisation procedure in less then 10 seconds, or it will be killed by the OS. This is probably because you are doing too many things in the startup phase.
Try to refactor your code to do it diffrently, by doing lazy initialisation, and only initialize what is really important before showing the first view.
It's hard to give better advice before knowing more about the app itself
I have faced this issue with Xcode 6.2 and Iphone 5s with iOS version 8.3.
I get this message when I deploy the application to the device for the first time.
The work around I found was that with out unintalling the application from the device,redeploy the application from Xcode.It should run perfectly this time.
I observed this only on Xcode 6.2 not on Xcode 6.3 so this might be an Xcode to iOS version compatibility issue.
Big and weird tip for this problem... this was happening to me and none of the advice helped anywhere on the web, but then i noticed if i deleted everything out of the main ViewDidLoad method it would work. I realized there was one line of code that was messing it up. It was a line that was referencing to an array of strings that was way to big. I had something like this NSString *mystring[100][1000][100]; i accidentally added some zeros and for whatever reason this problem produced the same error message that the incorrect signing gives you. So don't let your arrays or matrixes get too out of hand!
Method #1:
Lock your phone, press XCode start, wait till XCode says "unlock your device to launch", then unlock your phone, it will be launched successfully, works every time.
Method #2:
If your goal is just to debug the app, here is another simple and straight-forward approach:
After the app is deployed, launch it manually.
Goto XCode -> Debug -> Attach to Process ... to choose your app from the list, then debug properly.
This works well for me, and it saves lots of time.
I hope this helps, thanks!

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