Xcode: App builds, but "runs" and "finishes" at the same time - ios

I have an app created from sample code I found online. I hooked up my iPod touch 4G to my computer and everything worked fine, app ran.
Then I hooked up my iPhone 3G to the computer, established provisioning profiles, etc. In the organizer the device shows up as a green dot, so we're good. The name of the device is right there next to the run button so that's a good sign. But when I hit run it says "build succeeded" and then goes directly to "finished running on " but nothing shows up on the app!
I've tried this with several apps now and all work on iPod touch, but none on iPhone.
Devices are running newest operating systems, 4.2 for the iPhone, Xcode version is the newest.

I had a different question with more than likely the same answer
App built with Xcode 4.2 ios 5.0 crashing when installed on iphone with ios 4.3.5
I found the solution here
Is it possible to target older iOS versions when using Xcode 4.2 and iOS 5 SDK?
by mmorris
I had to do what he clearly explained and 1 more thing:
Set the compiler in the Project and Target Build Set to LLVM GCC 4.2
That got the app running on my older devices

I had problem to run on simulator not on device.
Tried above options but didn't work for me.
Finally, Just Resetting Simulator did the trick.

Make sure you are targeting the least iOS version and SDK that you can in the build profiles (targets, summary, Devices, Deployment target). Also, check the error console (All Output) at the bottom right and see if there's some kind of problem occurring.

Related

Instrument with iOS 9.3.1 [duplicate]

I have been trying unsuccessfully to profile my device (via Instruments) using the latest version of Xcode 7.0.1 (7A1001 released 9/28), as well as the previous version of Xcode 7 (7A218), as well as Xcode 7.1 Beta 2 (7B75).
My device is an iPhone 6+ with iOS 9.0.1 installed - the latest GM release of iOS9. I am able to run / debug applications on this device without issues.
In the screenshots below you can see that my device is disabled (greyed out) in all screenshots in all versions. I am able to profile other devices running iOS 8.4.1 without any issues.
Does the current version of Xcode not support profiling against iOS 9.0.1 or is there some kind of configuration setting or known work around for this?
Xcode 7.0.1:
Xcode 7.0:
Xcode 7.1 beta 2:
TL;DR - Perform a complete reboot of your device; restart Xcode & instruments; select "Open Xcode" if prompted to enable the device for development.
Update 3/31/2016: I haven't encountered any issues with the latest version(s) of Xcode (7.2.x, 7.3), so it seems that the stability here has been improved.
I believe I may have finally gotten this to work properly. Detailed steps:
Unplug the device from your Mac & power down the device completely (hold the power button for several seconds; slide to power off).
Close Xcode and Instruments.
Restart the device & once it has booted completely re-connect it to your Mac.
Re-launch Xcode. Here, my device showed as disabled and Xcode indicated that the device was not available for use.
Open your project; clean (Shift+Command+K), Build (Command+B), Profile (Command+I).
After Instruments launched I noticed that the device was enabled. Upon selecting it, a message was displayed with the title "Enable this device for development?" and message "This will open Xcode and enable this device for development." (Note that this only happened to me the first time I went through this process even though I had already been using the device for development - whereas some users have also reported that they are not presented with this dialogue.)
Click "Open Xcode". Here Xcode did not prompt me for anything nor was anything displayed - no additional messages indicating anything had been done or that the device was or was not available for development. Opening the Devices window, the device appeared to be available. (I have not been presented with this option for subsequent occurrences.)
Now I was able to select the device in Instruments and profile it.
As a side note, I was also again able to delete installed apps from the Devices window (I realized that this was not possible to do previously).
I'm unsure how my device ended up in this state however I will be on the lookout to see if this continues to occur.
Please note that this was done using Xcode 7.0.1.
Update: My device seems to lapse back into not being able to be used for profiling some time after performing these steps - I've had to reboot my device again in order for it to be available for profiling. Not sure what is triggering this behavior but I will file a Radar for this.
Close instruments -> reset your device by long pressing home and power button -> restart instruments. Works for Xcode 7.3.
According to Apple staff on the developer forums the behaviour of this issue is greatly improved in the Xcode 7.3 betas, so one easy solution is to try upgrading Xcode. I've upgraded and it seems to be behaving so far.
This issue still occurred with XCode 10.3 and iOS 12.4.2
I restarted the device only, and it worked.

Unable to profile app on device with iOS 9.0.1 using Xcode 7, 7.0.1 or 7.1 beta

I have been trying unsuccessfully to profile my device (via Instruments) using the latest version of Xcode 7.0.1 (7A1001 released 9/28), as well as the previous version of Xcode 7 (7A218), as well as Xcode 7.1 Beta 2 (7B75).
My device is an iPhone 6+ with iOS 9.0.1 installed - the latest GM release of iOS9. I am able to run / debug applications on this device without issues.
In the screenshots below you can see that my device is disabled (greyed out) in all screenshots in all versions. I am able to profile other devices running iOS 8.4.1 without any issues.
Does the current version of Xcode not support profiling against iOS 9.0.1 or is there some kind of configuration setting or known work around for this?
Xcode 7.0.1:
Xcode 7.0:
Xcode 7.1 beta 2:
TL;DR - Perform a complete reboot of your device; restart Xcode & instruments; select "Open Xcode" if prompted to enable the device for development.
Update 3/31/2016: I haven't encountered any issues with the latest version(s) of Xcode (7.2.x, 7.3), so it seems that the stability here has been improved.
I believe I may have finally gotten this to work properly. Detailed steps:
Unplug the device from your Mac & power down the device completely (hold the power button for several seconds; slide to power off).
Close Xcode and Instruments.
Restart the device & once it has booted completely re-connect it to your Mac.
Re-launch Xcode. Here, my device showed as disabled and Xcode indicated that the device was not available for use.
Open your project; clean (Shift+Command+K), Build (Command+B), Profile (Command+I).
After Instruments launched I noticed that the device was enabled. Upon selecting it, a message was displayed with the title "Enable this device for development?" and message "This will open Xcode and enable this device for development." (Note that this only happened to me the first time I went through this process even though I had already been using the device for development - whereas some users have also reported that they are not presented with this dialogue.)
Click "Open Xcode". Here Xcode did not prompt me for anything nor was anything displayed - no additional messages indicating anything had been done or that the device was or was not available for development. Opening the Devices window, the device appeared to be available. (I have not been presented with this option for subsequent occurrences.)
Now I was able to select the device in Instruments and profile it.
As a side note, I was also again able to delete installed apps from the Devices window (I realized that this was not possible to do previously).
I'm unsure how my device ended up in this state however I will be on the lookout to see if this continues to occur.
Please note that this was done using Xcode 7.0.1.
Update: My device seems to lapse back into not being able to be used for profiling some time after performing these steps - I've had to reboot my device again in order for it to be available for profiling. Not sure what is triggering this behavior but I will file a Radar for this.
Close instruments -> reset your device by long pressing home and power button -> restart instruments. Works for Xcode 7.3.
According to Apple staff on the developer forums the behaviour of this issue is greatly improved in the Xcode 7.3 betas, so one easy solution is to try upgrading Xcode. I've upgraded and it seems to be behaving so far.
This issue still occurred with XCode 10.3 and iOS 12.4.2
I restarted the device only, and it worked.

Testflight does not allow iOS 7.1 app compiled with iOS 8.1 SDK to install on iOS 7.1.2 iPhone

When I'm in the Testflight web app I see some apps I've built earlier that support iOS 6 and up, but the app I'm working on now does not show up. It's an iPhone 4 running iOS 7.1.2 and testers report the same issue. My device shows also like this version under "devices" and I already tried to reconnect the device, to no avail.
The minimum OS as displayed in Testflight when I go to incompatible builds is listed as iOS 7.1. At this point I'm a bit baffled about what to do. At this point I'm a bit baffled. Already tried to check all build settings and re-uploading the build to Testflight.
Twice I had the same error. Third time I've uploaded the same code with a different build number but with the same settings it worked. I suspect a glitch in the Matrix, a temporary problem on the side of Testflight

XCode 4.2 and ipod 2nd generation

I'm trying to run my application on my old 2nd generation iPod Touch running iOS 4.2.1 to test it on a non-retina device.
It seems that I have all the certificates and provisioning profiles setup properly, everything works with my iPod Touch 4th generation running iOS 5.0.
However, it neither shows my app on the iPod's screen nor the iPod's installed applications list in Xcode. Without any explicit warning from Xcode.
Could you tell me if I should downgrade to Xcode 3 in order to run and test my application on the old device, or am I doing something wrong? Where should I check?
Thanks!
#borrrden is correct that such a device is fine (just tested on one myself, in fact, using Xcode 4.3.x).
My first guess (though it seems odd you wouldn't get an error) is that you are only building for armv7, which at some point became the default in Xcode (don't recall whether this was in 4.2 or 4.3). You need to make sure that your "valid architectures" and related build settings include both armv6 and armv7 if you are targeting that range of hardware.

switching from xcode3 to xcode4 - can't load programs onto older iPod Touch [duplicate]

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
iPhone app does not run on old device (3G, 3GS, …)
I've got a similar problem to this (iPhone app does not run on old device (3G, 3GS, ...)) but the workaround on that page doesn't do anything for me. I have been developing iOS apps on XCode3 and testing on an older second generation iPod Touch running iOS 4.2.1. Been trying the last couple of days to use XCode4 instead.
I'm able to build and run apps under XCode4 using the simulator, both ones that I initially developed under XCode3, as well as brand new XCode4 created "Hello World" type ones. However, when I try to put one on the actual hardware, it fails with little in the way of error messages. The debug window in XCode4 doesn't show anything amiss. The activity/status indicator in the top middle of XCode goes from "Building [AppName]" straight to "Finished Running [AppName]" but the app never is transferred or run on the device.
If I look at the iPod's console via Organizer I see a bunch of errors like:
Thu Jun 16 15:17:56 unknown lockdownd[16] <Error>: 2ff68000 handle_connection: Could not receive USB message #6 from Xcode. Killing connection
Thu Jun 16 15:17:56 unknown com.apple.mobile.lockdown[16] <Notice>: Could not receive size of message
and I'm guessing it's related to that. I've tried unplugging all other USB devices from my Mac but makes no difference. Tried rebooting both the device and the Mac, but again no difference.
I have adjusted the iOS deployment target to 4.2, so I don't think there's any problem there. The device shows up in Organizer with the green dot and a valid unexpired provisioning profile. Under code signing properties it looks like:
Code Signing Entity Don't Code Sign
Debug Don't Code Sign
Any iOS SDK iPhone Developer (currently matches...[profile I have installed])
Release Don't Code Sign
Any iOS SDK iPhone Developer (currently matches...[profile I have installed])
The device itself is showing up in the Schemes dropdown as:
[DeviceName] (4.2.1 overriding Base SDK to 5.0)
Anyone else running into a similar problem or have any suggestions?
Just to promote Thomas' comment to an answer, this can be caused by targeting a CPU architecture that your device doesn't support. The iPhone and iPhone 3G (along with iPod touches of the same generation) don't support armv7. Set the "Archiectures" build setting to include "armv6" to ensure the resulting fat binary contains armv6 code.
I had the same problem with XCode 4.1.1 and an Ipod Touch 2nd gen. I started with one of the templates and couldn't run it on my hardware. Found all the answers here on stackoverflow, but it's better to have all necessary steps in one spot:
You have to add armv6 to Architectures in your project settings (Build Settings tab). You can set it to "armv6 $(ARCHS_STANDARD_32_BIT)" or "armv6 armv7", it doesn't matter. $(ARCHS_STANDARD_32_BIT) is just a variable which equals "armv7" in the newest XCode.
Don't change the Base SDK, "Latest iOS (iOS5.0)" is fine. Under "Summary" change "Deployment Target" to 4.0 or whatever iOS version you want to have as a minimum version.
The newer templates in Xcode 4 have a standard setting in your Info.plist which you have to change. Search "Required device capabilities" and delete "armv7".
If you're doing steps 1+2 but forgot step 3, you get the "Could not receive USB message" errors in the device log and no error message otherwise in XCode. Why it does that, instead of showing you an error message that hints you to "Required device capabilities" is a different question.
In Short: Apple started to drop support for the armv6 platform with the update to iOS 4.3. Newer hardware runs with a different instruction set, armv7. If you want to support iOS 4 with XCode 4, you should really make sure that you also build your project for armv6 correctly with the steps above.
It looks like you have iOS 5.0 SDK installed. Am I reading that right? If so, that is governed by Apple Developer NDA and should not be discussed here. I would post in the developer forums.
Do you have other devices running 4.2.1 that DO work with your installation of Xcode? Do you have any other devices at all that DO work with your installation of Xcode?
Please be aware that apparently the architecture setting is case-sensitive.
I manually added 'Armv6' and nothing still worked.
Changing this to 'armv6' did the trick.

Resources