XCode 4.5.2 started taking a long time to run apps on device - iphone

I started noticing that it was taking several minutes (5-10) to build and run apps on my iPhone 4S from Xcode. I was running XCode 4.5.2 and iOS6.0 on my 4S and decided to figure out the problem. There was another similar question posted here but it was closed without a definitive answer. (which is a shame since this is a valid concern for folks.) I am reposting the question to explain what I observed. Hopefully it will help someone.
First I rebooted my Mac after several impatient attempts to install a relatively small app seemed to hang. I tried removing all of my old provisioning profiles from my Mac and my iPhone thinking I was having trouble with expired certs/profiles. I tried a few more times and decided to let it just hang to see what happens. It eventually launched the app on my device after about 5-10 minutes. I Googled around and found some hints that maybe I should try rebooting my iPhone and re-synching with iTunes. (I had already made an unsuccessful attempt at synching which also seemed to take forever.) On my next attempt to synch I decided to remove some larger apps (700+MB) to clear space since I was down to my last GB.
Things were still slow so I decided to reboot my iPhone and then re-synching it. I rebooted my phone and went to sync in iTunes again and this time the sync went quickly. I had cleared an extra 3+GB leaving me about 4+GB of free space. I restarted XCode and my app is now installing quickly.
My take-away is such that I believe there may be extra daemons running over time on the device and restarting my phone is what ultimately helped restore install times. Also, I'm not sure if clearing space helped or not. I would like to know what the root cause/solution is but that depends on others having similar experiences and responding.

Related

Xcode 4 "Transferring package" pathologically slow after deleting app

I have noticed that when performing native debugging on Xcode 4 if I have my app installed, then delete the app, then attempt to debug again from Xcode 4, the time it takes to perform the step "Transferring package" is pathologically slow. Has anyone else experienced this? I dread deleting the app as it will take 20-30 minutes to load the app.
Our app has lots of user files that get deleted when app is deleted. Perhaps some sort of sync-like process is running at same time. Killing Xcode 4 does not fix the issue.
I think now you must use Xcode 6.3 and it will allow you to do everything in easiest way. Here this version of Xcode is most stable version I have worked with for last few years.
I would like to offer some general guidance on this as the symptom you see can have many causes. In fact most versions of Xcode have had these symptoms for differing reasons in my experience.
I've seen the slow transfer problem before (Xcode 4 I think), when I switched my app to be an app that could run in the background. To get around that, I would either force kill the app from the phone itself, or I would change the bundle id of the app when deploying it (as a hack).
68cherries commented on seeing the problem after profiling. Doing profiling of a device generates a lot of data on your Mac, and perhaps also on the device but I don't know. So its worth switching phones with another phone, ideally one that has a lot of free space; does the problem follow the phone?
Sometimes deploying has a problem when resources are missing; resources are rebuilt upon clean. Try pressing the option button and then doing a clean - it cleans intermediate files. (option-shift-command-k). This can happen in particular when you delete a resource but still reference it from a story board. Going through the story board looking for exclamation mark warnings is helpful (particularly with Apple Watch apps).
Periodically it is worth doing a resource file audit. Quite often we deploy files not actually needed by the target device. For example, bash script files, old icons, etc. The fewer resources, the fewer things that can be incorrect, and can often trigger an idea about what has changed with your resources that might explain the problem. It also makes the deployment smaller for your customers.
Note with this problem its worth debugging it from both sides. For example, look at your Mac console logs to see any errors, or your activity monitor for unexpected behaviours and tasks. On the device side, its worth installing iOS console from lemonjar.com to see if anything got to the device end and if there were errors there.

iPhone Project Not Running (more than once)

I have an iPhone app that I'm trying to run on my phone via Xcode.
It installs and runs without an issue
I make a change in the source code (negligible, like an NSLog())
It installs without an issue
Running causes the error:
Error Starting Executable 'myApp'
Don't know how to run. Try "help target".
I uninstall the app, and reboot the phone
It installs and runs without an issue (until I make another change; then I have to repeat this dance)
Needless to say, having to uninstall the app, reboot the phone, and reinitialize the environment (i.e. set prefs) takes an unreasonable amount of time, and is probably indicative of a serious problem. The issue is, the only vague error message I receive gets me nowhere on Google. Where on earth could this issue be coming from?
With some help from #iphonedev, I figured it out. Turns out it's a glitch in iOS 5 beta. The way to fix it is to remove the device from Development Devices, then re-add it.
Yeah just restarting the iPhone with the lock and home buttons fixes this. Had it happen a few times to me

Restart iPhone after installing or upgrading an app

What's the logic behind it? Ive been told by multiple apps to do this.
I've also noticed that if I reinstall/build the app too many times from xcode, it will become unstable and more likely to crash. A restart does fix the problems.
What's the logic behind it? Ive been
told by multiple apps to do this.
What apps? I haven't seen this yet myself, but I would guess that, if true, it might have something to do with the multitasking in iOS 4.0 and apps maybe not being quit if already running before an update. But it's strange.
I've also noticed that if I
reinstall/build the app too many times
from xcode, it will become unstable
and more likely to crash. A restart
does fix the problems.
Really, this sounds like a bit of folk science. Occasionally, a device can go a bit whacko, but that used to happen to me in (say) the days of 2.2.1. So if you can honestly reproduce this issue, I strongly encourage you to file a bug with Apple and get it fixed. Note they will probably ask you for a reproducible sample project in order to prove out this theory.

Why does the release build of my iPhone app crash on the device on the first run after installation?

I have an iPhone app that's been in development for about 2 weeks. We recently tried the "release" version of the build on a device, and to our great unhappiness, it crashes in one of the views with an "EXC_BAD_ACCESS".
This crash only occurs on devices, and only in the "release" build. Not only that, but it only happens the first time the app is launched! It is also 100% reproducible.
We have removed the small block of code that deals with data persistence, and have tried re-openning Xcode, cleaning the project, deleting and reinstalling the app, etc., as some other questions suggest.
Do you have any advice for a) what might be causing this problem, and b) how to go about debugging if it only happens in "release"?
Thanks
It turns out there was no problem in the code at all.
The reason it was crashing was that Xcode was trying to attach the debugger to the release build for some reason! We are still trying to figure out why, because we have checked the most obvious places, but I'm sure it won't be too hard to track down.
The build works fine if you install from iTunes or the Xcode organizer instead of building and running from Xcode directly, so it won't affect your end-users at all, as long as you are careful to check for other first-run issues.
We can only guess what the cause might but if it's 100% reproducible, then it should be a good candidate for some fprintf-style debugging.
Figure out the most probable place for the error to occur, and start putting "Got past xxx view initialization" style statements in to start narrowing the problem. It's tedious, but eventually, you'll get there.
In theory fprintf statements could affect the problem. However, it's rare that it does so, so it's a good place to start.

iPhone app was working, suddenly starts crashing on startup, reinstall fixes, but why?

Here's the situation:
-Had a development build of the app we just submitted on my phone, working fine for days (and previous builds worked fine for weeks).
-Yesterday, I touched the app icon, the app launches then crashes out (I wasn't connected to my computer at the time, but if I had to guess, it was around or before when applicationDidFinishLaunching runs). Basically, I briefly see my Default.png, then the app closes. This happens every time I try to run it.
-I restart my phone. No difference, the app is still failing to launch. All other iphone apps I have appear to be working fine.
-This morning I reinstall the app from my development computer and all is well, it's working fine again. No problems. This is the SAME EXACT CODE with the same build parameters.
This has me really worried, does anyone have any idea at all what might have happened? It's like the app permanently broke itself, before it even hits any of my code no less :(. I had a theory it might have had to do with an expired provisioning profile, but I didn't get any message then or when I reinstalled.
I'd appreciate any advice/pointers/ideas people have!
Connect your iPhone to the computer, launch XCode, go to the Window menu, and select Organizer. Click on your device in the left hand bar, and check your crash logs.
That should tell you when it is crashing, and why.
Actually, the crash logs should still be there from when your app WAS crashing, so even if you have reinstalled, you may be able to figure out what WAS going wrong.
Are you using core data?
Did you change your schema? That would cause a crash on startup and a reinstall would then fix it.
If it was the exact same code it seems to point to a data issue.