XCode 6.3.1 - lost connection to attached device frequently - ios

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.

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.

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"

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 (beta 4) keep getting "The Simulator can't be launched because it is already in use."

I keep getting the "The Simulator can't be launched because it is already in use." when trying to run my app, this only happens about 20% of the time but once so far the only way to get around it is to restart my Mac.
Tried the following but doesn't help:
Cleaning my build folder
Closing and re-opening xCode
Force close of simulator
I'm Using xCode 6 (beta 4)
Any Ideas for a solution that doesn't entail me restarting my Mac?
Thanks
"The Simulator can't be launched because it is already in use.”
This messege will be shown only if there is another xcode project that has launched simulator and hasnt stopped it yet, and u try to run the simulator from another xcode project.
Ideally stopping the simulator from the respective project(PS. not closing the application from the simulator, clicking the STOP button) would do it,
But if it still is working like that, then Closing the simulator, or resetting the simulator contents.
If that still dsnt work, then as a last resort i would ask u to reinstall Xcode, as if this problem keeps going on, then ur downloaded file might be buggy.
P.S if u opt to re-download n install xcode please keep backup.
Hope it solves it. Although i want your problem to be solved by step 2.
This normally just happens when running an app (project) on the simulator and then trying to run another app while the simulator is open (and normally is still within the first app you launched and it can't quit automatically). As long as you keep running the same app you shouldn't get this error and as soon as you run another app just make sure you've closed the simulator before or at least left the previous app with the home button.
Just Restart Your Mac , It Will Fixed
I had the same problem and fixed it without restarting. You just need to reset the content on ios simulator, exit xcode, and then to make sure that you've completely exited, right clicking on the xcode icon on your mac nav bar and click Quit. Open it back up and it should work.

Why does my app work in the simulator but get stuck on the splash screen when I run it on my iPhone?

My app runs fine on the simulator. However, when I run it on my iPhone, it gets as far as displaying the splash screen and then just stays there. It's an iPhone 3GS and the software version is 5.0.1. That's what happens when Debugger = None. When Debugger = GDB, I get an error message, 'Thread 1: Program received signal: "SIGABRT"', which I have learned can mean almost anything. I'm running Xcode 4.2.1.
I'm coming off a long hard night of battling with this error message, which appeared seemingly out of nowhere in a stable mature app. I tried to roll back with time machine, I deleted the Derived data for my project in Organizer a few times and did some of the other stuff recommended in this thread.
XCode 4 hangs at "Attaching to (app name)"
It got ugly. For a while, I couldn't even reboot my machine. Eventually, I was able to relaunch finder and suddenly the Simulator was working again. Two more pieces of information, I used to have to click allow in two dialog boxes when running on my phone but now it's only one (the one about code signing, I forget what the other one was about). Second, I find all the build architecture target stuff confusing but I set all my Base SDKs to be latest iOS. Lastly, I tried Product --> Clean and then Build but that didn't fix it. As you may have gathered, I'm getting my butt kicked. Any help would be much appreciated.
Dessie
Many times I have experienced Xcode going "crazy" with a physical device connected. At times I saw the behavior you describes; other the app simply refused to start;
In all of those cases, I could fixed it in either of two ways:
disconnect the iphone and connect it again;
reboot the device.
This is a very common problem that is easily fixable.
1) remove the app from the device
2) reboot the device
3) close Xcode and you must restart, logging out will not work

Resources