Xcode loses connection to device while debugging - iphone

My app has recently started exhibiting a strange behaviour. When I build and run from Xcode, the app launches until it hits the transition from the animated launch screen to the main screen of my app. At that point Xcode says "finished running yourApp on theDevice" and the app itself sometimes continues running on the device, or sometimes freezes.
Once this has happened, Xcode behaves as though my device is disconnected until I physically unplug and replug the USB cable.
Anyone run into this before and found a solution?
Potentially related, I have recently begun to see the "The device does not recognize this host" error periodically (mentioned here and here), although my app does not use Entitlements.

I had a similar issue and from this link started checking my project for images,textures etc larger than 1024 x 1024 and found one png which was around 2732 x 2048. After reducing its size I am not getting this bug.

I'd suggest trying with another cable plugged in another port.

Related

Running my own Swift app on real device shows only LaunchScreen

I can run my Swift app(Xcode) on real device, but it shows only LaunchScreen. I waited for more than 20 minutes, but nothing else shows. Anyone know, why there is this problem?
There are a few things you could try. You haven't given a lot of detail but from my understanding you have tried pairing it with a physical device and can only see the initial screen when you run the app.
I would try
Restarting Xcode
Making sure the app works on simulator
Unplugging and Replugging the cable into your phone
Restarting your phone

Xcode doesn't see my iOS device but iTunes does

I have a strange problem.
I have an iPad with iOS 5.0.1 (9A405) and iOS SDK 5.0.1 with Xcode 4.2 (Build 4C199) installed on my Mac.
Xcode doesn't see my device. It says "iOS Device" not "Sauron's iPad" as usual.
(I am sure that device is connected because I see it in iTunes.)
Xcode denies to start my application on device.
It says:
"Xcode cannot run using selected device. No provisioned iOS devices
are available with a compatible iOS version. Connect an iOS device
with a recent enough version of iOS to run your application or choose
an iOS simulator as the destination."
Xcode sees my other iPad with iOS 4.3.3 and can run applications on this device.
I have tried to restart my Mac - without result.
I also checked provisioning profile, developer certificate, etc.
Does anybody have ideas?
Even though this one does not address the specific problem of the OP, it might be a solution for other people finding this question.
In some circumstances, Xcode will not recognise (won't even see) a connected device that was previously recognised, even though there were no changes in Mac OS/iOS/Xcode versions. This seems to happen if you connect the device while the Mac and/or the device are locked when you connect them. The device will ask if you want to trust the computer even though you already did so, but the device will still not be visible in Xcode.
Restarting Xcode or the device do not seem to have any effect. One solution is to reboot the Mac. Another much quicker solution is to restart usbmuxd:
Quit Xcode
Disconnect the device
In a terminal window, type: sudo pkill usbmuxd (it will be restarted again automatically)
Restart Xcode
Connect the device
Your device should now be visible again in Xcode!
Select Window ➜ Organizer in Xcode.
Now under Devices, select your device.
If it is not ready for development then click use for development.
If above doesn't solve your problem then from your project settings, set deployment target to one which your app is developed for or lesser.
Otherwise there is some issue with certificates and provisioning profiles. Make sure your device's UDID is added in the provisioning profile you are using.
Had the same problem , restarted xcode and it found my phone again.
I get this problem once, using a not official Apple cable.
Hope it helps.
I ran into this issue today where Xcode 8.2.1 suddenly decided the connected ipad (ios 10.2) was no longer connected. Unplugged, plugged back in, rebooted my macbook, and tried numerous recommendations above.
The thing that fixed the issue for me was shutting down and rebooting the ipad device itself.
To others who might have the same issue and the answers above don't work: Make sure that the iOS version installed on your device matches the iOS SDK version you have installed on your mac. If these don't match you are unable to build to the device.
In my case I did next steps
Quit XCode
Disconnect device
In your terminal sudo launchctl stop com.apple.usbmuxd
Relaunch Xcode
Connect device
May be my answer is helpful to new developer.
Just follow these step , You can connect your iPhone/iPad with X-code.
I just barely tried every solution suggested above. The only thing that worked and resolved my issue was to go into xcode's "Organizer", right click on my iPhone, click on "Remove from organizer" and then wait about 10 seconds while xcode automatically re-added the device.
I previously plugged in my phone and itunes recognized it fine and synced with it, etc, but all xcode said in the organizer was "Device is not currently connected", which it was most definitely connected if itunes was syncing with it and not syncing over wi-fi.
Why xcode needed me to delete and re-add the phone is beyond me, but it works great now that I did this.
I tried all of the above to no avail. I had been using the phone for ages and suddenly the Organizer thought "this device is currently not connected". A reset of the phone fixed it for me (hold Home & Power until the Apple logo). I did so with it still connected to the MacBook, but it shouldn't be necessary.
For Xcode 7 (and possibly above),
go to Window -> Devices,
hit the plus sign at the bottom and select the device connected and hit next, then Use for development.
This only works if Xcode is reading your device, but you aren't able to run your app on the device.
Also make sure the device's OS version is greater than or equal to your app's Deployment Target OS version.
If none of these work, try simpling restarting your iphone or device! Works every time for me (:
Here is how I figured out the problem. Go to Xcode -> Window -> Device and Simulators -> Devices. There you could see Errors and Warnings. I found that my Xcode has to be updated because IOS version of my device is higher.
Xcode did not see my iPad, iTunes also did not see my device.
Rebooting Mac corrected the situation.
Had same problem with some non-licensed cables. Works fine with Apple's & Belkin's USB cables.
My app worked on all simulators but not on my device. I tried just about all the steps from each comment and didn't have any luck. I went to my device settings and switched my "Personal Hotspot" from off to on. Then it was all good!
Have you tried to delete and re install the device in your Apple Developer portal? If yes, try to upgrade your xcode to 4.3.2, I remember that I needed to update to xCode 4.3.2 after updating my iPhone to iOS 5.1
After updating my iPhone to 10.3.3, Xcode 8.3.3 cannot find it in the Device window but iTunes can. Restarting Xcode fixed the problem.
After 20 minutes of debugging, I realized I had to hover over the up button (🔼) at the top of the Devices picker in the top left hand corner, to the right of the run app button 😂
The error I had in XCode was "iOS version lower than deployment target", which I didn't know how to fix. The error was displayed where the iPhone should have been indicated as a Device (upper left). I selected the project in Project Navigator and noticed that the iOS Deployment Target was set to 11.3 but when I checked my iPhone it was set to 11.2.1 (or something lower than 11.3). So I opened Settings on the phone, scrolled down to General and tapped Software Update. Since the update said it was scheduled but didn't start, I decided to take the SIM card out of my other phone and put it in the iPhone I was using for testing. Then the upgrade started quickly. After the Update finished on the phone, however, XCode still didn't recognize the phone. I unplugged the USB cable but didn't hear any sound, so I plugged it into another USB port on the computer and then heard a sound. Then XCode noticed the phone. So the problems were that the iPhone didn't inform me that I had an Update (or I ignored it and forgot about it) and it may have needed the SIM card, and I had a bad USB connection.
Had the same problem. In my case it was my usb cord.
I had this problem. I somehow registered the device for generic team on apple. I don't remember how I did it now. Then I was able to overcome this error.
Just unplug the cable of iPhone with your mac and then plug cable in mac work for me.I hope it's work for someone.
Xcode 6.3 didn't see my iPhone running iOS 8.3 even after a computer restart. I then restarted my iPhone and everything worked again. Love buggy software!
When you trying to build and run the current scheme but encounter this alert message:
"The run destination iPhone is not valid for Running the scheme."
Plus you already check your phone and it is connect to your Mac properly,
all you need to do is just simply restart your Xcode and build it again. That will do the job.
Ran into this issue having upgraded from XCode 9 to 10.1. No devices at all were appearing in XCode, despite performing all the steps listed in other answers.
For me the solution was to do a clean CMake build, deleting the old Xcode project files.
Xcode 10.2.1 was not recognizing my ipad mini. I unplugged and rebooted the mini and it became visible.
The problem was solved for me when I used an original cable. You also get an original cable.
I tried all the ways here but still didn't work. I plugged the cable that I connected the phone to the computer instead of another socket and it worked.
This is absolutely bizarre!
Xcode has been working fine with my iPhone for weeks, and today it stopped working. None of the tips above worked.
Finally I switched the cable from the left hand side port to the right hand side port, and now Xcode is recognizing my phone! PHEW!
But only on that specific port. Going back to the left hand side port still doesn't work!?!?!

App crashes on device and while using instruments only

I am encountering a strange behaviour, my app runs smoothly on simulator but crashes on device.
Also when i try to detect leaks using instruments it just crashes on both simulator and device.
I am totally stuck as i am not even able to generate any error message on console, also NSZombieEnabled is on in the settings.
I can see two possible reasons for the behavior you describe:
device is short on memory; (but you would see some processing in this case)
your app uses a newer SDK than what you have installed on your device (like using the SDK 5 twitter framework and then running your app on an SDK 4 device).
Specifically, in case 2, you would not see any log messages because the app would fail as soon as it tries to load the missing framework in memory.
In any case, inspect the device log in Xcode Organizer window to have more info about the crash. This is the only way you can understand what is happening.

Test Application on iPhone 3G without SIM card

I am working on one application that has APNS in the same. And for the same purpose,i have installed an SSL certificate in the application. For the purpose of getting the device token,i am attaching the device with MAC and the organizer window starts connecting to the iPhone device and starts copying the files but it sticks at a point saying copying file 2 of 2 and takes hours but in vain.The symbol next to device remains orange in Organizer. I am using Xcode version 3.2.6 and have iPhone 3G for testing.
Is this possible due to No SIM in the iPhone device or some other reason? Kindly help. I really have lost so much time on the same issue.
Thanks in advance.
I don't know if it the same reason or not but after testing my application on iPhone 3GS, i was able to run my app successfully.

iPhone 3G + iOS4 debug problems

I recently updated our test iPhone 3G with the latest version of iOS 4 to be able to test our apps on the new OS. I regret that I didn't read the forums because after the update the device's performance suffered a lot. However this is not a problem because the device still works. The problem is that when I try to debug our app the device freezes for minute and reboots or closes the app and returns to the home screen. When it manages to stop at breakpoint it takes few seconds to step over or out and often there's no debug information about the variables. I assume that this is due to some memory issues because the new OS requires more memory space. I must point out that our app worked fine with the iPhoneOS 3.1.3 and the Xcode 3.2.2 with the 3.2 SDK. It is a Universal app and that runs fine on the iPad too.
I have seen this problem as well when one of my applications was consuming a lot of memory. The background application that handles the remote debugging consumes quite a bit of ram (~15M the last time I had this problem). If your app is fine in standalone mode and crashing under debug then you might be close to the limit running in standalone (as I was).
I noticed that making sure that all other applications were quited or if I rebooted the iPhone that I was able to debug my executable (this was until I found the copied object problem that was causing the memory bloat).
If you have a jailbroken iPhone then you will have other services running consuming memory as well.
the iPad has double the ram 256M than the 3G at 128M.
I have also seen a problem when opening an application with a url encoded with data that runs > 500K that it will crash springboard before your debug session is started with a delayed launch.