11

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?

Community
  • 1
  • 1
Thomas Feiler
  • 295
  • 4
  • 11

4 Answers4

7

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.

Adam Wright
  • 48,938
  • 12
  • 131
  • 152
  • This helps indeed. You can add back support for the devices running on the armv6 architecture by manually adding it (the string "armv6") to the list of architectures in your build settings. – Age Mooij Oct 11 '11 at 07:59
  • 1
    I saw this solution and thought you had solved my problem - ever since installing the iOS 5.0 SDK I have been unable to install / test apps on my iPhone 3G. (But the iPhone 4 works great) But - the architectures are listed as "arm6 arm7" - and I am still stuck. – radven Nov 03 '11 at 05:58
  • UPDATE: I deleted the current architectures and recreated them as "armv6 armv7" and now it works. Yay! – radven Nov 03 '11 at 06:50
  • 1
    I have essentially the same problem, and mucking with the architectures doesn't seem to help. "Valid architectures" is "armv6 armv7", as are all three flavors of "Architectures". I've tried setting "Build active architecture only" (whatever that means) both ways. No joy. – Hot Licks Nov 15 '11 at 19:25
  • UPDATE -- Turns out there are "Architectures" settings under both "PROJECT" and "TARGETS", and the one under "TARGETS" is the one you need to set -- the "PROJECT" setting is apparently ignored. (And no error message for any of this stuff.) – Hot Licks Nov 15 '11 at 19:43
  • 3
    I had this issue, and 'one more thing' I had to update was the `Required device capabilities` in `info.plist`. It mentioned `armv7`, so I removed that entry, which helped. – beetstra Nov 30 '11 at 23:49
  • Also, don't forget to do a Clean (from the Product menu) before trying to rebuild/run. – BHSPitMonkey Feb 15 '12 at 09:36
5

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:

  1. 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.

  2. 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.

  3. 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.

shapecatcher
  • 907
  • 6
  • 9
  • Great summary. I was still pulling my hair out, though, even after following these steps, until it occurred to me to do a Clean (Product->Clean). After this, the app installed and ran perfectly. – BHSPitMonkey Feb 15 '12 at 09:34
2

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?

jschmidt
  • 2,898
  • 3
  • 24
  • 27
2

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.

Shawn Chin
  • 84,080
  • 19
  • 162
  • 191
RJ Mooij
  • 21
  • 1