Cannot run app on real Apple Watch - ios

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"

Related

Fixing Xcode 9 issue: "iPhone is busy: Preparing debugger support for iPhone"

I'm looking for more information on the message below. Xcode 9 seems to be hanging for a couple minutes already...
How can I tell Xcode 9 to quickly recognize my previously used device updated to iOS 11?
.Alex’s iPhone is busy: Preparing debugger support for .Alex’s iPhone
Xcode will continue when .Alex’s iPhone is finished.
There are multiple solutions for this:
Solution 1: Patiently wait for 10 to 15 minutes. Have a tea or roam around ;-)
Solution 2: Disconnect device from the system. Restart both iPhone and Xcode and then rebuild again.
Solution 3:
Go to Windows → Devices and Simulators (Shortcut key: cmd+shift+2)
You’ll see iPhone device connected to system with message
iPhone is busy: Preparing debugger support for iPhone
Click on plus button (+) present in bottom-left corner.
This will show the device connected to system. Click on Next button.
Thereafter you’ll see ‘device setup was successful’. Click on Done button.
Solution 3 worked for me!
Solution 4:
Unpair your device and then pair it again. Thereafter follow Step 3.
I clicked ‘Cancel Running’, opened the Devices list, unpaired my iPhone, removed my USB cable and reconnected it, paired the iPhone, and then was asked on my iPhone to enter my passcode ("pin code"). Did this and then was finally able to pair my phone correctly.
Wait a few minutes. The application will start automatically
Restarting Xcode worked for me (quit and start again).
What didn't work for me:
waiting for an hour on one device
waiting for an hour on another device
restarting devices
unpairing/pairing devices
It turns out XCode opens device manager window beneath it and waits for you to hit the next button. Switch to that window, hit next and you get the progress bar for the process to show up.
In my case, iTunes was open, so
1 - open iTunes
2 - access you phone
3 - click to disconnect your phone
Now the device is ready on XCode
Hope it helps....
below solution worked for me, follow steps to resolve your issue:
Step 1: Cancel Running
Step 2 : open Window menu and select Devices and Simulators
Step 3 : Unpair the iPhone
Step 4 : Removed iPhone USB cable and reconnect to the system
Step 5 : Pair the iPhone when you connect then you will be asked to Trust or Don't Allow, Please click Truct on your iPhone and enter your passcode (Pin Code)
Note : I performed all the above steps they worked for me. The issue of my device debugger gone.
Below is the Screenshot of Devices and Simulators Menu
I unplugged my cable and saw this. After it reached the end I was able to run it no problems.
You don't have to unplug to see this; just hit cancel and you will see its progress.
On your iPhone:
Settings > Developer > Clear Trusted Computers
Wait a few seconds, it's all.
Click on Window menu
Select Device and Simulators
Select your device
Click on + button at bottom left corner
Click Next
Click Done
I found deleting the app from the device and re-installing with Xcode solved this issue.
I have been using my iPhone X to debug via Network and suddenly had this problem.
Disable "Connect via network" and try again with USB.
This trick worked for me.
I realised I had less than 100 MBs of free space on my disc. Freeing up disk space solved the issue for me!
Simple solution:
Open Window -> Devices and Simulators
Unpair iPhone on the side list
Unplug and plug again the USB cable
Press Trust in the prompt message in the device!
Then it should work! It worked for me
I had the same problem many times, these things worked for me:
restarting my phone + xCode.
checking that both your Mac and your iPhone are connected to the same Network.( has a high potential ).
repairing my phone.
When you plug a New device which is having iOS 11, Xcode 9 will Prepare Debugger Support for that device, At this time you should Wait to complete it.
Then run the project in that device it will run smoothly.
If you didn't keep patience while creating Debugger Support then it will throw the error mentioned in the question.
My setup
macOS 10.14.6
iOS 13.2.3
Xcode 11.2
Tried all the "speedrun" tips up till 2019-11-24 without luck.
The wait seemed inevitable but incredibly long in my case:
with a freshly upgraded iOS version.
I then found this comment on reddit which makes the most sense:
This is required when you connect a device with an iOS version that
the respective computer's Xcode didn't see before. It saves them in
/Users/username/Library/Developer/Xcode/iOS DeviceSupport and it does
take a while. Don't restart Xcode as it will not help you, just wait
for it to finish.
It takes quite some time because these debugger
support files occupy a lot of space (29 GB for me), though you can
safely delete any version from there, and if you connect a device with
that version again, it will re-save it from scratch.
So if you just upgraded your iOS, then the "from scratch" part could take longer than usual, also depending on your network condition. In my case, it is definitely much much longer than the "10-15min" other people claimed. I measure it by hours.
A lot of tricks seem to have worked but they neglect the fact that time goes on as you try things while Xcode keeps working on the setup in the background, and quite possibly resumes its job whenever you do a restart/reboot cycle.
This led me to noticing that my Xcode version is just one step behind the iOS point release. After upgrading my Xcode, it worked.
But it took longer because I removed the iOS DeviceSupport folder by following a tip!
So here are my suggestions:
Check your Xcode version down to the minor version to make sure it should actually support the iOS version.
Check your Mac's free disk space to make room for newly generated device support content under ~/Library/Developer/Xcode/iOS DeviceSupport as this tip suggested.
Check if you have connected your device to a fast-enough USB port, as this tip suggests.
Wait till Xcode finishes "preparing for debugging".
If it doesn't finish in a few seconds or minutes, keep waiting.
DO NOT remove any folder as some tips may suggest. Removal would simply make you wait longer!
The Best way:
Disconnect the Iphone.
Clean xcode by command+ shift + k or by going to Product -> Clean
Connect again
Run again
rebooted iPhone, closed all other open applications and unlocked phone worked
Clean : Shift-Command-K is what works for me.
For me it Worked after following the below steps
Step-1 Go to Devices and Simulator
Step-2 Deselect Show as run destination and Connect via network Options
Wait for Few seconds to Load the Xcode, If you want you can restart Xcode also.
Step-3 Follow the same steps and got to Devices and Simulators
Tick back both the options and it will be normal to install your app back.
Do this Two Task to solve your problem:
First Go to Xcode then -> Preferences -> Accounts then below click the plus icon to add apple id it must me same as your iphone device apple id.
Second Just change the cable if first solution can not work
I updated to iOS 11.0.3 then the error appeared. After restarting my iPhone and XCode, it showed "Could not launch the app", so I navigated to the phone's device management to trust, then it solved.
I had this problem because I hadn't given iTunes permissions to run on the computer. (I don't use iTunes for music, so I had foolishly just hit "decline" in annoyance whenever the EULA dialog box came up.)
Unpaired my iPhone
Removed my USB cable and reconnected it (Do make sure that you unplugged the USB and plugged it back in)
Paired the iPhone.
(3 important steps)
Xcode 10.3 Solution
The following error messages apply:
iPhone is busy: Preparing debugger support for iPhone
Xcode will continue when iPhone is finished.
An error was encountered while attempting to communicate with this device. (The service is invalid.)
Please try rebooting and reconnecting the device. (0xE8000022).
Follow the steps in Jayprakash Dubey's post above
and
Close Xcode;
Delete contents of DerivedData folder ~/Library/Developer/Xcode/DerivedData
Restart Xcode & iPhone
Pair Xcode & iPhone again
& run application
Today, I have faced the issue and tried out everything mentioned here and different pages as well. Nothing worked for me.
Lastly, I have reset the iPhone, then tried building the application and finally it worked for me.
I updated my iPhone to the latest version 11.0.3, then restarted my iPhone. Restarted my XCode 9. Then it worked.
For those looking for solution with Apple TV, I just experience the exact problem "Apple TV is busy: Preparing debugger support for Apple TV” with Apple TV 4K with my Macbook Air (Early 2015)
The solution is not to unpair or restart devices. But to switch network. I brought it to a faster and more open network and it works perfectly.
TL;DR: Settings > General > Profile & Device Management > (Under DEVELOPER APP category) click my email address that happens to be my Apple ID > Trust Developer
This might not be relevant to anyone else, as I am new to iOS development and this was my first attempt to install an application on my phone, but I'll provide the answer as it wasn't yet listed.
I went through restarting my phone, restarting Xcode, unplugging and plugging back in, clean building, and even removed the device from the Devices and Simulators menu. However, I believe the cause for me was that I hadn't added my developer certificate to the listed of trusted certificates on my device.
I am on iOS 10.3.3 so the navigation and wording in Settings on the phone might be slightly different, but the final step I took before this issue was fixed was to trust my developer certificate as an individual developer on my phone.
To do that, go Settings > General > Profile & Device Management > (Under DEVELOPER APP category) click my email address that happens to be my Apple ID > Trust Developer
Whether or not that was the cause of my problem, I am unsure. This was, however, the last step that I took before the app ran on my phone successfully after doing all of the other steps listed above.

app iOS accepted by Apple, crashes at launching, but works after plugging iPhone to the Mac/Xcode

UPDATE 2 :
We have at last a crash log : https://www.dropbox.com/s/62sq0ybyr4mhkkh/Screenshot%202015-09-02%2012.26.54.png?dl=0
It seems that a library is not loaded...
UPDATE 1:
Here's what we have :
- no crash log on Xcode with a device where the app crashes at launch
- We didn't run the app via Xcode, we downloaded it via Diawi
- We plugged the iPhone on the Mac, we didn't run the app via Xcode, we just looked at the crash log (nothing to see). After we unplugged the iPhone from the Mac, the app launches perfetecly ! Besides, when we uninstall the app and install it again via Diawi, it launches perfectly again !
- So the simple fact that we plugged the iPhone to the Mac makes the app work.
Any idea ?
Below the first message
I have a serious issue with my iOS app, here's what we know :
The app has been approved on App Store
But if we download it via App Store promo codes (it's like a private beta), it crashes at launch, mostly on iOS 8.3 or below.
We had the same issue by adding UDIDs and sending the app via Diawi before the submission
We have already an app on the store (let's call it v1) and we have submitted a new version (v2) which has been a new project on Xcode.
The crash happens with people who had already the app v1 as well as people who hadn't
The crash remains even if you uninstall the v1 and install v2
We put crashlytics : impossible to get any crash report, it crashes before the init, although we can see the launch page with the logo. We tried to put a delay of 10 seconds to let crashlytics initialize, but it doesn't last untill the 10 sec
Weirdest thing : when we plug the device on Xcode to see what happens, then it works ! Impossible to see the crash again. Then, even if you uninstall and repeat the process by installing via Diawi, it will work ! As soon as you plug the iPhone on Xcode, it will always work...
Some people told us that it crashes and it works the day after.
What we did :
We updated the Pods
We changed the certificates and provisionning profiles and made it clean
We had some issues due to the Parse SDK, but we fixed it
The target is iOS 7.1
Here are the pods that we have (screenshot):
https://drive.google.com/file/d/0BzHfUya4Va4rb2dQSVJYazN1MFBxcG1DQnpBNXAybU9SVzk4/view?usp=sharing
Has someone seen already such an issue ? The weirdest thing is that Apple hasn't rejected it.
Thank you for your help !
So I had exactly the same problem today with my app Macro Defense: https://itunes.apple.com/us/app/macro-defense/id955086416?ls=1&mt=8
I found that by turning wi-fi off on the device, the app runs perfectly. If this is also the case with you, then my guess is that the problem lies in trying to perform some network functions in the appDelegate.
Have contacted apple support, and will repost if I get a definitive answer to this.
Cheers!

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!

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 process launch failed: Security

I have been developing an app for 1 or 2 weeks now and just yesterday I have updated my iPhone 5S to the iOS 8 GM. Everything worked fine and I could test on my device as well until I deleted the app from my phone and wanted to build again. The following error appeared:
Could not launch "My App"
process launch failed: Security
When I test with the simulator it works fine.
Is this because of the iOS 8 GM update and how can I fix this launch problem?
I want to be able to test on my iPhone and in the simulator.
If you get this, the app has installed on your device. You have to tap the icon. It will ask you if you really want to run it. Say “yes” and then Build & Run again.
As from iOS 9, it is required to go to Settings → General → Device Management → Developer App → Trust`.
On some versions of iOS, you will have to go to Settings → General → Profile instead.
Updated answer for Xcode 7: Tapping the app no longer works (as of beta 1 it just displays an "untrusted enterprise developer" message with only a Dismiss button).
To fix, open the Settings app, go to General / Profiles, and you'll see your profile. Mark it trusted and things should start working normally again.
Updated For iOS 9.2.1 and Xcode 7.2.1:
Goto: Settings > General > Device Management > Select App from Developer Apps > Trust App.
Hey so the accepted answer works, except if you need to debug the initial launch of the app. However I think that answer is more of a work around, and not an actual solution. From my understanding this message occurs when you have some weirdness in your provisioning profile / cert setup so make extra sure everything is in tip-top shape in that dept. before ramming your head against the wall repeatedly.
What worked for me was as follows from the apple docs:
Provisioning Profiles Known Issue If you have upgraded to the GM seed
from other betas you may see your apps crashing due to provisioning
profile issues.
Workaround:
Connect the device via USB to your Mac
Launch Xcode Choose Window ->Devices
Right click on the device in left column, choose "Show
Provisioning Profiles"
Click on the provisioning profile in question
Press the "-" button Continue to removing all affected profiles.
Re-install the app
Make sure you right click on the image of the device not the name of the device or you won't see the provisioning profiles option. I restored my new phone from an old backup and there was a lot of cruft hanging around, i also had 2 different dev. certs active (not sure why) but i deleted one, made a new profile got rid of all the profiles on device and it worked.
Update for iOS9.2.1 and Xcode 7.2.1
If you get this error when building to a device in Xcode:
On your device, tap the app icon that would have just been added from your attempt at building the app and you should see this:
Next, on your device, go to Settings --> General --> Device Management, and you will see this page:
Select the profile you are using with Xcode, and you should see this page:
Click Trust "username#email.com" then click Trust on the next popup.
Go back to Xcode and re-run your project and it should build the app to your device.
To get around the process launch failed: Security issue and immediately launch the app on your device, tap the app icon on your iOS device after running the app via Xcode.
This will allow you to immediately run the app. It may not actually "fix" the root issue that is causing these permission alerts.
Be sure to tap the app icon while the Xcode alert is still shown. Otherwise the app will not run. I continually forget this vital step and am unable to run the app on my device. Thus I am documenting it here for myself and everyone else :)
Run the app via Xcode. You will see the security alert below. Do not press OK.
On your iOS device, tap the newly installed app icon:
After tapping the icon, you should now see an alert asking you to "Trust" the Untrusted App Developer. After doing so the app will immediately run, unconnected to the Xcode debugger.
If you do not see this "Trust" alert, you likely pressed "OK" in Xcode too soon. Do not press "OK" on the Xcode alert until after trusting the developer.
Finally, go back and press "OK" on the Xcode alert. You will have to re-run the app to connect the running app on your iOS device to the Xcode debugger.
Go to SETTINGS -> GENERAL -> Profiles & Device Management
and choose the developer profile, then push Trust.
if you do not have Profiles & Device Management menu, you have to enroll your device on beta.apple.com and download the profile from Safari.
Install the profile
Restart your device
Tap on the developer profile and trust.
You are all set.
I have the same issue. I click ok in xcode and when launching the app on my iPhone I'm asked if I want to trust this application. Doing it, the app runs and further build-and-run from xcode went without any issue until deleting the app from the iPhone and reinstalling it. Then goto first line ;-)
Alternatively if one does not see "Untrust App Developer" dialog:
Go to your iPhone > Settings > General > Profile > "you#email.com" > Trust
In iOS 9.2 they renamed the 'Profiles' to 'Device Management'
This is how you should do it now:
Settings -> General -> Device Management
Verify the app
Ok, this seems late and I was testing the app with the Internet connection off to test my app for some functionality. As I turned off the Internet, it gave me such an error. After I turned on the Internet, I could install it again. I know this is silly but this might be helpful to someone.
I had this issue before on Xcode 7. Then I realized it's all about my Internet connection: it was down, and the security check was using the
Internet to make sure your developer account is correct. And when it saw no Internet it gave this error … after I have fixed my Internet, it works well.
Xcode is able to build and install the app, but isn't able to launch it the first time. You just need to tap on the app's icon on the phone, then you will be prompted to ask if you want to trust the developer. Allow it and the app will launch, then Xcode will be able to automatically install & launch this and your other apps.
"If you get this, the app has installed on your device. You have to tap the icon. It will ask you if you really want to run it. Say “yes” and then Build & Run again."
To add to that, this only holds true the moment you get the error, if you click OK, then tap on the app. It will do nothing. Scratched my head on that for 30 odd minutes, searching for alternative ways to address the problem.
BTW, this also happens if you change the team of your target in Xcode and rebuild. Was quite puzzled to see that problem with an app that I had run on the device before. Took me a while to figure out…
Might only happen the first time building to a device with a team, though.

Resources