Finished Running on iPhone - iphone

I am trying to test my app on an iPhone 4S. When I build and run from Xcode, the project is successfully compiled but after that Xcode says:
Finished running MyApp.app on MyiPhone
The app perfectly work on the simulator and the provisioning profile works correctly (I tried to load an empty app and it works).
If I try to manually load the app I get this message:
The Info.plist for application at
/Users/*/Documents/App/AppName/DerivedData/AppName/Build/Products/Release-iphoneos/AppName.app
specifies a CFBundleExecutable of AppName, which does not exist.
Where is the problem?

The connection that XCode creates with the device is rather fragile, and can easily be corrupted if anything goes amiss in the debugging test, most commonly if the developer stops a build, while it is being moved to the device.
I have a routine of things I go through, when this occurs. If one doesn't work, I go further down the list.
Check your signing certificates
: This error can occur if you mess around with the certificates too much. Make sure your current scheme uses the Debug signing when making a debug build, and check in your application settings if the current debug signing certificate is a debug certificate. (Not AppStore, AdHoc or Enterprise).
Reestablish connection with the device
: Look under devices in your Organizer. Check if the device you are using is present and marked with a green bullet. If orange or grey, reconnect the device with the USB. For precaution, wait a couple of seconds from taking the cable out before you insert it. It should make no difference if you eject the cable from your mac, or the part connecting your iDevice.
Reactivate development on the iDevice
: Being unaware why this happends, some devices revert to a non-development stage from time to time. Clicking the "Enable development" under Organizer > Devices seems to clear this off.
Flushing XCode device connections
: Something that often is needed, you can simply shut down XCode (and to be safe, close the iPhone simulator as well) and start it up anew. Deleting the debug application present on the iDevice is also a good idea.
Restart your iDevice
: Tedious as it might seem, restarting your iDevice is sometimes needed, since the pipe held on the device might be corrupted.
Restarting your developer machine
: If everything else fails, a restart of your mac is often required. I have never experienced this error without having it fixed by now.
I hope this checklist will help you through.

Try cleaning the project.
SHIFT+CMD+K

Found the same bug in XCode 9 while running the project on iPhone 5s. Clean the project and it will work.

Clean.
Build.
Run.
It's work for me.

I had similar issue. When I run program on iPad2 it compiles and installs app on device, wait for some time, and display an alert. Then I followed steps below
1) Removed that application from device.
2) Disconnected iPad and tried again.
Then it successfully run in device. If this not resolved your issue, do
Rename your application to some thing else and try to run. It will run. Lastly you can make an "ipa" file with Ad Hod distribution and can test on device.

Looks like you are trying to run a release product on the device. You are probably signing it with production key. Run it as debug.

Maybe I'm totally off with this guess but the last time I got the same message was when I had some required hardware capabilities set in the Info.plist which the target device didn't comply with. (E.g. requiring a camera and trying to run the app on an iPad1.)

I've just finished chasing down a similar problem.
An app that worked on the device (iPad 1) and on the simulator stopped loading on the iPad but continued to function as before on the simulator. When "run" with the device as target, it compiles and then goes immediately to "Finished Running...".
I did all the usual bits - removed the app from the device, ran Product/Clean, removed derived data, shut computer and device down cold, but with no luck. Other development apps loaded and ran fine.
This app uses GameKit. When I removed the gameKit requirement from Info.plist, the app loaded and ran correctly on the device again - including the GameKit functionality (no kidding). When I added gameKit back in, it failed again. When I added the gameKit requirement to other apps, they failed to load to the device as well. It appears that something has happened to the gameKit setting on the device, although gameKit is there and functions as always. I'm suspicious that this one has to do with the state of the sandbox.
I've got to make a few changes to get the app running on the iPhone and I'll test that as well. I'll repost if I sort it out.

Si it seems that XCode build, ran and finished but the app failed to be deployed and was not even copied to the device.
In fact, there should be something in the XCode project that is broken. This is easily corrupted. The best move is to build a new project from scratch. Don't forget to add armv6 support if needed.
It works well for me!

Check the device log
It may occur, that you are using a provisioning profile, which does not allow one of the entitlements, listed for your target.
For example
entitlement 'entitlement-name' has value not permitted by provisioning profile 'Your Profile Name'

For me, the usual culprit is that I have an app store build already on my device.
Different/same version numbers might make things worse. I haven't looked into it too deeply since deleting the version that is already on my device usually fixes the issue.

Related

iTunes Connect Vague App Rejection - Pulling My Hair Out

So, I recently uploaded about 9 apps that were mutations of an original one, just with different content and the same framework...
So, today all 9 of the apps went into review at the exact same time although they were each uploaded a day apart, which I thought was really odd. 5 hours later I get 9 rejection emails and the same rejection as follows:
2.2
We found that your app failed to launch on iPhone 5 running iOS 6, on both Wi-Fi and cellular networks.
We encountered the issue when selecting the application on the Home screen - the app displayed a launch image then quit unexpectedly.
This may be because iOS 6 uses a watchdog timer for applications; if
an application takes too long to complete its initial startup, the
operating system terminates the application.
For information about the watchdog timer, please see Technical Q&A: Application does not crash when launched from debugger but
crashes when launched by user..
Another possibility could be a missing entitlement. For more information, please see the Technical Note: Resolving "0x800003A",
applications not launching and "missing entitlement". For discrete
code-level questions, you may wish to consult with Apple Developer
Technical Support. Please be sure to:
include the complete details of your rejection issues
prepare any symbolicated crash logs, screenshots, and steps to reproduce the issues for when the DTS engineer follows up.
For information on how to symbolicate and read a crash log, please see Tech Note TN2151 Understanding and Analyzing iPhone OS
Application Crash Reports.
If you have difficulty reproducing this issue, please try testing the workflow as described in
https://developer.apple.com/library/ios/qa/qa1764/Testing Workflow
with Xcode's Archive feature".
I've uploaded a number of apps before and have never received this sort of issue.. So, I followed their suggestions and it's not the dogwatch timer, as the app runs absolutely flawless when ran from xcode on my iPhone 4s with iOS6, and also runs without any issues when I distribute it as ad-hoc enterprise, and sync the app through a .ipa file onto my iphone...
Although, before testing any of this I went through and revoked my development and distribution certificates, went through my keychain and deleted all instances of any certificates related to apps, and keys. Then refreshed everything. All my code signing / provisioning profiles are valid, I re-added my device to the provisioning portal as well.
Does anyone else have any ideas? I'd like to be positive I fixed the problem before uploading my apps again, waiting a week just to be rejected once again and have to start all over. Any help or leads would be greatly appreciated!
I have also double checked all of my info.plist bundle identifiers and they all match the dist and development profiles associated with each app.
I finally got around to finding a friend with an iPhone 5. The crashing WAS due to armv7s architecture being used. So I stripped out all architectures and used only armv7. Worked like a charm and the app ran as smoothly on my 4s as it did on my friend's iphone 5.
Did you try compiling in armv7 only? (forget the armv7s support). By the way, yeah, it's impossible to test it without any iphone5 hardware, and the simulator actually don't simulate anything. With only armv7 feature it should (i really say "should") behave like in iPhone 3G/4/4s on ios6.
Or did you have some runtime behavior depending on the device? What are you actually set on startup?
Look at this post:
http://wanderingcoder.net/original-armv7s-psa/
Even if it talk about linker error, here is the philosophy: Don't publish something you haven't, can't test. Use armv7s only when you will get rich an have an iPhone 5

Xcode Succeeds Build, but does not copy to iOS Device, and terminates debugger immediately

This problem is pretty ridiculous and I'm running out of ideas of what to try:
I have been successfully using Xcode to debug my game on my iOS device (iPhone) for the past couple of weeks, but now all it will do when I try to do a run with my iPhone set as target is successfully build the application and then Stop immediately. No Errors, nothing in console logs. The application doesn't even copy over to my device.
Xcode says: Building, Running, Finished Running....all within 2 seconds...
I'm using Xcode 4
iOS 4.3
I've tried the following:
Rebooting mac
Deleting application from iPhone and
rebooting iPhone (although my power
button no longer works on my iPhone,
so I had to run down the entire
battery to try this)
Cleaned project and rebuilt
Nothing seems to help.
The game compiles and runs successfully on the iOS Simulator within Xcode as well, and as I've said I've been able to copy my game over prior to yesterday, but for some reason it just stopped working...
UPDATE: Solved by setting the "accelerometer" from "NO" to "YES" in Info.plist.
I know you found your answer but I found a similar case when starting a project from XCode 4, the app plist contains a required device capabilities "armv7".
So even after adding armv6 to the build settings, the program didn't run on a 3G.
I deleted the required device capabilities "armv7" and it works.
Solved by setting the "accelerometer" from "NO" to "YES" in Info.plist.
If it helps anyone, the problem for me was a blank value in my plist under "Required Device Capabilities." Deleting the blank value fixed the issue.
My problem was "gps" value in plist under "Required Device Capabilities."
Deleting it fixed the issue for iPad2.

XCode 3.2.5: Deploy Debug Build to iPhone iOS 4.2.1 is FAILING

I am having one of those horrible days where absolutely everything is broken.
I'm trying to deploy my application to my iPhone. I have done a full system restore to 4.2.1 on both devices. The iPhone is simply having none of it: http://cl.ly/3O1C242k210T2I0w253Q -- What's going wrong?
Organiser picks the iPhone up no problem, gives it the green light, but XCode won't deploy the app: 'No provisioned iOS device is connected'
I have tried:
rebooting the computer, restarting X code, plugging in the iPhone, attempting to deploy. pretty much every combination thereof.
organiser -> deleting and recreating Xcode's default provisioning profile
target settings -> making sure the correct provisioning profile is selected which it is
going onto developer.apple.com -> provisioning portal, and making sure X code automatic provisioning profile is there as it should be, which it is
putting the iPhone in to restore mode, and reinstalling the latest iOS
The only thing I can think of is that it is a UK locked phone, with a UK SIM inside, and when I turn it on it gives me some ' waiting for activation ' message: http://cl.ly/0I390x2Z3E3A040V2J2h so maybe it is possible that it never activates and this is somehow a barrier. can anyone confirm?
( I doubt it is this; I'm pretty sure the phone is capable of activating itself even tho I'm not in the UK, seeing as I have the correct SIM card in. I remember one time reinstalling iOS or something similar, and it needed the activation. so I think it does successfully activate. However, I don't know how to check whether activation has completed or not. )
But I have successfully deployed a load of apps to this device in the past. I can't understand why XCode is digging its heels in today?!
PS the only other thing I can think of Short of buying new hardware is reinstalling Xcode, which I guess I will have to try at some point. maybe even reinstalling my MacBook's OSX. but really I can't see how this would help...
I'd suggest checking your code-sign parameters. Maybe it's signed with app profile that doesn't have your device's UDID added through provisioning profile?
Someone on IRC got me to try deploying a default template app, and that worked.
I subsequently removed and reinstalled the SDK, and the problem has gone away.

iPhone Device Debugging

Is it possible to actually use the Xcode debugger when running an iPhone app on the device rather than the simulator? i.e., can I have the device stop at breakpoints that I set in my code and step through the code as it runs on the device?
EDIT: I should mention that I am a registered developer with Apple and have a valid certificate. In fact, I can build and run iPhone applications on my device just fine. However, even in Debug mode, my application will not stop on breakpoints or output to the console when I run it on my device. If it helps, my application will function normally in debug mode (e.g., stopping at breakpoints) when I run in the simulator.
EDIT 2: I've tried resetting my phone, completely removing and reinstalling Xcode, creating a new project, changing all the settings mentioned in the answers on this page (as well as others), cleaning and building my project, Build and Debug... If I click Pause, it says "Error from Debugger: Quit". :( Maybe I'll try to debug on this device using Xcode on another computer and see what happens.
EDIT 3: Well, I tried using another computer using a fresh install of Xcode in a new project, and I still can't get device debugging to work. I have a suspicion that it's my iPhone or cable perhaps? I'd like to think that I'm not so incompetent that I've missed something so embarrassingly obvious, but I've double- and triple-checked all of the suggestions mentioned here.
EDIT 4: FINALLY got device debugging to work. I have a feeling that something low-level on my device was causing issues...nothing I did worked on my system. However, I installed Xcode on another system and device debugging on the same device (with the same cable) worked flawlessly. Directly after that, device debugging began working on my original machine, leading me to believe that some strange hardware flag was screwed up and somehow "reset" on the second machine. In any case, it works now... Thanks for all the help. :)
Also, I'm unsure if it's better to leave this question unanswered or pick the most "helpful" answer...
Yes -- just use a device build. You have to get certificates and provision it.
This is a good description:
http://boga.wordpress.com/2008/07/16/debugging-ipod-provision-profilescertificates/
Make sure to start debugging by pressing "Cmd-Y"... and not "Cmd-R" :-)
You may try last trick in case nothing can help.
If your application launched successful on your device from XCode but did not stop at breakpoints - try press "pause" button after start in debug mode. If you will see application paused properly (do not react to user's action) add new breakpoint then press "run" to continue application execution. In some cases it may helps to stop at new breakpoint.
Yes, just set your project to build for the Device.
If you need to setup debugging for jailbroken iPhone (up to 2.2.1) (not pay 99 to Apple yet) follow next steps:
Install MobileInstallationPatch for your iPhone via Cydia (use Search Tab)
Switch off PROVISIONING_PROFILE at XCode: Go to /Developer/Platforms/iPhoneOS.platform/Info.plist, add next keys:
<key>PROVISIONING_PROFILE_ALLOWED</key>
<string>NO</string>
<key>PROVISIONING_PROFILE_REQUIRED</key>
<string>NO</string>
You may also add these keys to any
project particularly at XCode, Project
Build Settings, User-Defined
variables.
Add key to your project Info.plist at XCode
SignerIdentity = Apple iPhone OS Application Signing
Don't forget to install and add to your project settings self-signing certificate from Apple
http://developer.apple.com/documentation/Security/Conceptual/CodeSigningGuide/Procedures/Procedures.html#//apple_ref/doc/uid/TP40005929-CH4-SW2
"Build and Go", you can connect iPhone and start debugging.
Important! You may need to install and launch at least one legal app (any free one) from App Store first (before "Build and Go" step). Otherwise your application will be successfully installed by XCode to your device but may not be launched. Try this troubleshoot first in case of problem with app launching.
Yes. Debugger and performance tools work fine on the device. That's where I do most of my debugging.
Xcode>preferences>debugging uncheck load symbols lazily
fixed the breakpoints not holding in device problem for me.

Error Installing iPhone App on Device

I set up all my certificates and keys today and am trying to run my project on my iPhone.
I'm encountering this strange error:
Your mobile device has encountered an unexpected error (0xE800003A) during the install phase: Verifying application
Poking around the Apple Developer forums, I've attempted to set new certificates and provisioning profiles as well as editing Info.plist, but no matter what I do I can't seem to run the app on my device.
The only think I can currently think of is that my project name in Xcode differs slightly from my development provisioning profile (it uses a question mark), but I've named it according to Apple's conventions: com.mycompany.myapp, so I'm unsure if that's the problem.
Any ideas?
Edit: I've hard restarted the phone, rebooted Xcode, cleaed my targets, set up a new wildcard App ID and respective provisioning profile and still nothing. Any other ideas?
It turned out that I had 2 certs in keychain that were simultaneously overwriting each other! I hope this helps people in the future.
You should create a wildcard app ID; com.mycompany.*. That may help.
I've encountered this on many occasions. What i do is clean all targets, shut down xcode, and hard reboot my phone.
This is a different error than the more common problem of getting the cert wrong...
Restore the phone (using the XCode Organizer to reload the latest OS), to be safe do not restore from backup when you sync with iTunes the first time (it'll still keep your number when you sync even if you don't use the backup). I've had to do this a very few times, the last one was when it was in the middle of deployment when I unhooked the phone from the cable (had to answer a call).
Try the reboot (of the phone) first, hooking it up with XCode off. But if that does not solve things, restore is the way.
The console tab in the XCode Organizer sometimes gives helpful hints as to what happens during the install phase. In one case my problem was my app already existing on the phone. I deleted my app and the install succeeded.
Regardless, it looks like a lot of error messages are bundled into this one cryptic message and to really diagnose what is going on, I found the Console tab very useful...
One other thing to try is reinstalling the iPhone SDK. I ran into an error like this when I first got my developer key and this was the only way around.
Just want to say to everyone, when you go to edit Targets-> be sure to set "configuration" in the top left corner to "All Configurations" or the correct config you are building for (Debug or Release). You might think you have things set correctly but it will be for the wrong configuration.
I've seen that error on a correctly provisioned device that has had success installing apps from XCode before, and I've had luck restarting the device and trying again. Maybe that will help.
Try running in Release mode instead of Debug. I have a working project with this problem. No idea what the issue was, but running it in Release mode works, but Debug mode produces the error code.
I have a support ticket open with Apple dev support for the same problem, and (FWIW) I'll post their recommendations if and when they can get my toolchain working.
Try this: (source: http://ephemera.lifewithalacrity.com/iphone_development/)
Even though this is supposedly only for Distribution builds, it helped me to be able to install my Debug version on my iPhone again, after it mysteriously broke yesterday.
"just triple check that all the code signing in your project properties are clear or default"
Note, this is the PROJECT properties as opposed to the TARGET properties. I set my Code Signing Provisioning Profile back to the default and removed the Code Signing Identity string.