Xcode 4.2 + LLVM 3: unable to run on iPhone3G - iphone

Just installed Xcode 4.2 for Snow Leopard and started to developer a new project. The app successfully runs on iPhone4 but isn't on iPhone3G. The code gets build, compiled, ran and finished. I just get a message "Finished running ...". Here's the settings that I have set both on Project and Target Build settings:
Build otions->GCC_VERSION = Apple LLVM 3
Architectures->ARCHS = "armv6 armv7"
Architectures->SDKROOT = "Latest iOS5"
Deployment->IPHONEOS_DEPLOYMENT_TARGET = "iOS 3.1"
Linking->OTHER_LDFLAGS->Debug->Any architecture |Any SDK = "-ObjC -all_load"
Any ideas or suggestions what else should I try?

This problem appears to happen when creating new projects with Xcode 4.2. When creating such projects, Xcode adds one hidden key in app plist file, that restricts device to run on armv7 architecture only. You need to delete that key. Also, you need to replace "standard (armv7)" to "armv6 armvv7" value in ARCHS build setting, both in project and targets build settings. And also to check ONLY_ACTIVE_ARCH is set to NO.

I have seen 'finished running...' in my code too with an iPhone 4. Whenever that happens, I do a clean build and also uninstall the app from my iPhone. Post that, things start working again.

Related

XCode 4.5 (4G182) + iPhone 5 iOS6 - Choose a destination with a supported architecture in order to run on this device

So I have a brand new app I created last night for iOS6, using XCode 4.5. I can properly develop on my iPhone 4 with iOS6.
Today I got my new iPhone 5 with iOS6 and, after updating the certificates with the new device UUID, I tried to run my app on it and got this error:
XCode cannot run using the selected device. Choose a destination with
a supported architecture in order to run on this device.
I've enabled the device for development. Both armv7 and armv7s are on the settings.
I have included the sources from the Facebook 3.0 SDK and the linker flag '-lsqlite3.0'. I'm guessing the issue has to be related, but cannot figure what is wrong.
Any ideas how to solve it?
PS: The issue happens too when running the app on the simulator. No idea what changed on my project or XCode between last night and today, other than I have a new device and new certificates.
The selected destination does not support the architecture for which the selected software is built. Switch to a destination that supports that architecture in order to run the selected software.
Also you need to select the compiler LLVM in
Project --> Build Settings --> Build Options
I have found the same issue while running an OLD project on XCode 5.0 and My solution is:
You need to do following steps for getting out with this:
1. Set Valid Architectures : armv7,armv7s
2. Set compiler as LLVM in Project ---> Build Settings ---> Build Options.
3. Set Base and Deployment sdk properly.
This is my solution. Happy To Help.
You need to add armv7s to your valid architectures under your Target's Build Settings.
You included src/Framework/Resources/Info.plist when added Facebook SDK files to your project. Just remove it from your project and everything will work again. Guaranteed! :)
I have solve the problem using the below steps.
Close the Xcode
Delete the application from device
Restart the device
then re-run the application
it is working fine..
Make sure the bundle name (in plist file) is same as the project name. I changed it and it worked.
One of my 3rd party libraries couldn't run on armv7s so I removed that option. I also removed armv6 and kept armv7 as the only option. It built and ran on the phone with only armv7.
I have solve the problem using the below steps.
Close the Xcode
Delete the application from device
Restart the device
then re-run the application
it working fine..
I faced this problem because Build settings-> Complier for C/C++/Objective c was set wrong.
So I changed it to default compiler available, it worked!
Just need to select the compiler LLVM in
Targets --> Build Settings --> Build Options
I ran into the same problem. When I check the compiler it is showing incompatible compiler. you need to make it valid one. To set valid compiler follow the steps
select your
project----> build settings-->
on the search bar type compiler and search
now you can find build options under build options you will find compiler for c/c++/objective c set it to valid one.
So basically I created a new project, copied all the sources and everything seems to work fine. At least the app runs.
I am not sure which setting was causing the problem.
I had an issue with an out of data library that was built for iOS 4.x and I was building a new app for iOS 6 with iPhone 5 support. I received this error and the only way I resolved it was to make armv7 the only architecture and valid architecture listed in my project and target build settings.
remove info.plist refrence. And then re-drag info.plist to proj but don't copy to "target"
You just goto Build setting Then valid architecture Replace armv7 armv7s instead of armv7 .Then it will work fine .
Ok, not sure if this is the Problem in Your Project. But what fixed it for me, was to change the Name of the Info.plist File.
I changed the name from Info.plist to my-project-info.plist
also change it under target-build-settings/Packaging/Info.plist
Than delete the App from Devices/Simulators and re-run the App through Xcode
In my Case, everything worked fine since than. In my Case there was nothing wrong with the specifications made in the plist file or with the valid architectures.
some times this happens when your project was build in xcode 4.5 and you are trying to run in xcode 5.0.
so in my case I found the solution.
Change your compiler for C/C++/ObjectiveC Go to Build
Settings->Build OPtions->compiler for C/C++/ObjectiveC; select
Default(Apple LLVM5.0)

XCode 4.4.1: Can't Deploy to Device or Simulator: Unsupported architecture

I'm having some trouble deploying to any device in XCode 4.4. I have only tested on armv7 devices, but I only wish to deploy to armv7. The application compiles without issue.
Device Error
Simulator Error
I have checked that the Architectures and the Valid Architectures in the build settings contain only armv7.
I'm working in an XCode Workspace with one project and one subproject. The subproject creates a static library which acts as a target dependancy to the main project.
Other questions suggest that the deployment target might be wrong, but I checked this too and it is set to iOS4.0 for all projects and targets. (All devices are iOS5.0 +)
Does anyone have any suggestions please?
Though I couldn't find exactly why this was happening. I fixed it by removing the project data.
Close XCode
Open Terminal
cd to your .xcodeproj directory
Recursively delete any project data files associated with the current user name
find . -name "YOUR_OSX_USERNAME_HERE*" | xargs rm -rf
Reopen XCode
Just for luck, do a clean build
Edit
Had this error again and wasn't solved by the above steps alone. There were two other factors:
Make sure Info.plist isn't part of the Target Membership
Clear DerivedData
Quit Xcode and iPhone simulator
Unplug your devices
Goto ~/Library/Developer/Xcode/DerivedData/
Delete all data under this folder
Start Xcode again and run your project
I've found that Xcode really seems to like '$(ARCHS_STANDARD_32_BIT)' for 'Architectures'. If its not set to that try it, 'Valid Architectures' with armv7.
Just curious - if building for newer phones only, why not use a deployment target of 4.3? You'll be able to use some of the new block technologies not in the earlier releases.

Is it possible to target older iOS versions when using Xcode 4.2 and iOS 5 SDK?

I just recently downloaded the Xcode 4.2 with iOS 5 SDK package and I immediately noticed that I am unable to use my iPhone 3Gs with iOS 4.2.1 for debugging. I am only able to debug and test on my iphone 4 with iOS 5 installed.
For any of my devices running any iOS less than 5.0 Xcode just says "Finished running for iPhone3GS" and doesn't run it. I have my deployment target set to 3.0 because I am not using any features in my app above 3.0 and I want to be able to target all versions 3.0 or higher. I have all my provisioning profiles installed and up to date.
I have quit and restarted xcode, I have cleaned the build multiple times. I have tried adding armv6 in the archtecture build settings, but nothing will allow me to build and run my app on my old phone with ios 4.2.1.
My question is, is it possible to still make apps with the new SDK work for iOS versions lower than 5? How can I be sure that my app will still run on lower iOS versions if I am unable to install them on my old phone?
Edit:
OK it looks like iOS SDK 5 dropped support for armv6 by default. What you have to do is add armv6 in the Architectures field under Build Settings for both your Target and your Project. Then your app will be able to run on iPhone 3G devices.
Answer can be found here
How to build for armv6 and armv7 architectures with iOS 5
I was having the same issue trying to get a newly created Xcode 4.2 project running on an iPhone 3G 4.2.1. Here is how I was able to get it to run.
1) Change the Target's "Build Settings" ==> "Architecture" from "Standard (armv7)" to "other". Add armv6 and armv7.
2) Change the Target's "Build Settings" ==> "Valid Architecture" to armv6 and armv7.
3) Change the Target's "Build Settings" ==> "iOS Deployment Target" to iOS 4.2.
4) Open the projects *-Info.plist, remove the setting "Required device capabilities" (note it required armv7)
btw I figured this out when I tried to manually add the app via the organizer and it reported:
Can't install application
The Info.plist for application at /Users/.../TestsDebug.app specifies
device capability requirements, which are not met by Dev iPhone 3G
All should work after that. Talk about a PITA.
Go to Xcode > Preferences > Downloads and install debugging support for older iOS versions.
mmorris got me close to resolving the issue...
In the Info.plist, I had to set the Required Device Capabilities to armv6, not armv7
Hope this helps others out as well.
You need to connect the phone and then go to the organizer. Xcode should automatically request the older version.
See the developer page for more info. It was described in the notes for the 4.2 beta
I encountered a similar problem trying to run my app on an old iPod Touch. I upgraded to Xcode 4.3.3 and the app would no longer run in the debugger for me on older hardware.
I believe the other comments here about "Architectures" and "Required device capabilities" are important details to specify correctly. Unfortunately, they weren't enough to fix my problem.
In my case, I found the build scheme to be the culprit. Xcode 4.3.3 prompted me to switch from the GDB debugger to LLDB when it upgraded my project. When I changed the Run action of my scheme back to GDB, I was able to run the app again on my old hardware from Xcode.
I found out that I had to add armv6 to architectures, but still did not work. And now I have removed armv7 from required capabilities, and that was it! It worked!
This worked for me and should work for you if you had an older version of Xcode previously. If not then you should follow the advice given by others to obtain the SDK from an older version of SDK:
sudo cp -a /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk
This command is only a little bit different from that shown by others, but those commands dropped the files in the SDKs folder itself for me - we want a subdirectory of it to be created with the appropriate name.
In my case there was a redundant line
in Required device capabilities
I just removed it...
Hopefully it will help someone else.

xcode cannot find the software image to install this version

I'm new to xCode development and struggling my way through the provisioning system trying to run a Hello World app on a real device. I went through al steps and everything seems fine but one thing:
When i click my device (Iphone 3G running IOS 4.2.1) in the xCode organizer the following message is displayed under Software Version: Xcode cannot find the software image to install this version...
Also the provisioning profiles show no status in the organizer (both in the library and on the device). On the provisioning portal they have the status active.
I hope someone can help me, thanks!!
ps. i am working with xcode 4
Update: OK, I've found the solution -> set deployment target to 4.2 in info tab: https://discussions.apple.com/thread/2780316?start=0&tstar
The message "xcode cannot find the software image to install this version" seen in the organiser window... This is just a notification rather than a problematic error.
If you want to eliminate this message anyway, I found I was able to do this by running restore within iTunes. Part of that process involves downloading some stuff, which I presume is the 'software image'.
But, as explained in Technical Q&A QA1569 "This message does not prevent you from using the device for development purposes. The only effect is the inability to reinstall the OS currently on the device using Xcode." ...and that has been my experience. Back in the main Xcode window you're still able to click 'run' and send the app to the device to run.
...and it will run assuming everything else is set-up OK, but there are various other gotchas related to Xcode 4.2 and v4 devices:
As mentioned by Overbeeke you should ensure the 'deployment target'
of your project is set down to the desired version (the minimum
version of the devices you want to support) Additionally I would
point out that the 'SDK version' should normally remain set to the
latest (it's whatever SDK Xcode on your machine is using)
As mentioned by Kenneth Lam, in the new Xcode you need to frig around
with "armv6/armv7" settings if you want to support earlier models of
iPhone. Follow these instructions to add the right "Architecture" armv6 setting. Additionally I would point out (as per this answer further down) that there is a setting called "Required device capabilities" from which you need to remove 'armv7'. This is in your app's plist file.
I'm saying all this like I'm an expert, but I still can't get it to work on a v3.1.3 device :-)
I think Xcode 4 requires that you are running the latest iOS to use that feature, but you don't need it to install apps on a device. I have run my apps on an iPod Touch 1G (which can't be upgraded to iOS 4.3) with the same iOS as you and it worked.
Have you added your device to the provisioning profile?
What I did is opened the organizer, right click on the device on the left pane and select "Add device to provisioning profile" where you will be asked for your Apple ID (within xcode) and it will add the device to your profile without you leaving xcode, much simpler than using the online portal.
Xcode 4.2 only builds armv7 targets by default. (Iphone 3G running IOS 4.2.1 is armv6) Add armv6 build targets by following these excellent instructions from Nick "Warning: iPhone apps should include an armv6 architecture" even with build config set
just an update, to update the iOS deployment target, click your project in the left pane, the one with the blue 'A' icon. click the build settings tab (not info), instead of showing "basic," show "all." iOS deployment target is in the deployment section.
There could be a number of things, but i would make sure that that your deployment taget in build settings is at or below your target . Check the "deployment section" in the build settings of your project. The default sets the deployment to the highest iOS version, if the ios version is below what is set you will not be able to run the app on that device.

IPhone App died under iOS 4.1. No code changes

I installed iOS 4.1 just released today.
I downloaded my app to the Phone from the AppStore and ran it and it cant get GPS Location.
I download the new XCode and 4.1 SDK and recompiled under 4.1 and app works fine on 4.1 IPhone.
No code has been changed.
Why doesnt an app compiled under 4.0 work under 4.1.
BASE SDK was 4.0
IOS DEPLOYMENT TARGET : iOS 4.0
NEW Settings
BASE SDK was 4.1
IOS DEPLOYMENT TARGET : iOS 4.0
Bit annoy I need to resubmit even though I havent changed anything...another week of black hole app submission!
After 3 attempts at deploying to the App Store and lots of dissecting the project file I found the following:
The deployment target was different for BUILD and TARGET
And base sdk only set in Debug in Target
I got the Debug/Release to work on my phone so presumed if relelase and Distribution had same settings should work in App Store.
But even after setting it and redeploying to appstore it failed to work (app loaded and no GPS).
I tried deleting the Provisioning Profile but didn't work.
Overnight phone lost power and when I restarted app was working.
so not sure if it was a weird combination of all 3.
iOs Deployment Target (IPHONEOS_DEPLOYMENT_TARGET = 4.0;): iOS 4.0
BASE SDK(SDKROOT = iphoneos4.1;): iOS 4.1
for BUILD (Debug/Release/Distribution) (Right click on top level in tree YourApp >> Info menu)
and TARGET (Debug/Release/Distribution) (Right click on Target >> YourApp >> Info menu)
Release the app on 4.0 to app store.
4.1 released
Upgraded my app to check it.
App ran ok, but failed to get GPS in a number of screens.
Recompiled it under 4.1, NO CODE CHANGES, released to store, still wouldn't work.
Debug version ran ok on 4.1
Release didn't
Distribution (version from app store) versions didn't. Failed to get GPS.
Dissected the project file to see whats the difference.
Found that
Target and Build settings weren't identical.
IPHONEOS_DEPLOYMENT_TARGET = 4.0;
Was set for BUILD for Debug/Release and Distribution
but
for TARGET it was set for DEBUG to
IPHONEOS_DEPLOYMENT_TARGET = 3.0;
and NOT set at all in RELEASE and DEBUG
I deleted the build directory and set
IPHONEOS_DEPLOYMENT_TARGET = 4.0;
for BUILD (Debug/Release/Distribution) (Right click on top level in tree YourApp >> Info menu)
and TARGET (Debug/Release/Distribution) (Right click on Target >> YourApp >> Info menu)
Rebuilt
Release version now work so had to hope setting same in Distribution would work.
Released to app store. Was approved in 2 days both times.
Tried it. App ran but no GPS.
Tried deleting the provisioning profile, no luck.
overnight phone lost power so restarted.
Tried the app and it worked.
So maybe
To check this yourself.
Copy the YourApp.xcodeproj to a safe location.
Rename so extention no longer .xcodeproj
This becomes a folder.
Open and it will have 3 files
Build settings are in project.pbxproj
Scroll to the bottom:
look for
/* Begin XCConfigurationList section */
Notice theres two sections on for Build and one for Target
/* Build configuration list for PBXNativeTarget
...
/* Build configuration list for PBXProject
If youve done a Distribution build then each will have Debug/Release and Distribution settings
1D6058940D05DD3E006BFB54 /* Debug */,
1D6058950D05DD3E006BFB54 /* Release */,
C55BCF5811ADCA470050ABDB /* Distribution */,
The 24 digit hex number point back up to section further up in the file.
IF you lay the 3 sections (side by side in a table) you can see the differences.
Only differences
TARGET (Debug, Release and Distribution)
1D6058940D05DD3E006BFB54 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
....
IPHONEOS_DEPLOYMENT_TARGET = 3.0;
....
};
name = Debug;
};
not set for Release/Distribution
BUILD(set for Debug/Release/Distribution)
IPHONEOS_DEPLOYMENT_TARGET = 4.0;
SDKROOT = iphoneos4.1;
developers using location services are noting problems on 4.1
https://devforums.apple.com/message/294717#294717
Apple finally admitted its a problem in 4.1
https://devforums.apple.com/message/307257#307257
Some information that you may find helpful about this issue:
This issue only affects applications when the app is uninstalled and subsequently re-installed. It does not relate to distribution via the App Store vs. your own builds of the device.
Rebooting the device will fix the problem.
This issue is fixed in iOS 4.2.
https://devforums.apple.com/thread/70688?tstart=0
Hey it's me again. I'm replying to you on multiple forums.
Are you by any chance using this deprecated getDistanceFrom: method? It might be the culprit, although you'd expect it to work or not work consistently between XCode and the Appstore :/
https://developer.apple.com/library/ios/prerelease/#documentation/CoreLocation/Reference/CLLocation_Class/DeprecationAppendix/AppendixADeprecatedAPI.html#//apple_ref/occ/instm/CLLocation/getDistanceFrom:
UPDATE: Removing this deprecated method didn't fix the problem for me :-(
When you clicked 'Info' to access the build configuration to SDK4.1, did you have the project's title highlighted or the Target? It seems there are two sets of build configurations. I had the same GPS problem as you. I also thought I was using SDK4.1, but I actually wasn't.
Check your entitlements plist file (for us ent.plist). Ours used to have some mention of location services, and now it does not! No idea how that happened though.