Xcode 5: about 64-bits architecture and backwards compatibility - ios

I've developed an iOS app whose Deployment Target needs to be 5.0, so the target's Build Settings > Architectures > Architectures value has to be the standard without the 64-bit one (XCode complains about my deployment target if I try to include it).
I've read this post: Xcode 5 and iOS 7: Architecture and Valid architectures dealing with this backwards compatibility, but some things are still not clear for me:
They say in that post that last Xcode update allows to build both 32-bit and 64-bit but only for a deployment target of iOS 5.1.1 and later. I'm targeting iOS 5.0, how should I handle this? Will Apple reject my app if I only submit a 32-bit build and I don`t take advantage of iPhone's 5S 64-bit processor?
And finally they don't explain the difference between Architectures and Valid Architecures values in target's Build Settings, could somebody explain that?
Thanks!

Recommendations
I'm targeting iOS 5.0, how should I handle this?
Based on your requirement it appears the only option is to build the 32 bit app only. This should work on the iPhone 5s in 32 bit mode.
Will Apple reject my app if I only submit a 32-bit build and I don`t take advantage of iPhone's 5S 64-bit processor?
No. It has been publicly stated that 32 bit apps will continue to run on iPhone 5s although there is a known bug where 32bit apps will not support bluetooth operations on a 64 bit device (link). I have submitted a 32 bit app to the store which ran fine on iPhone 5s.
And finally they don't explain the difference between Architectures and Valid Architecures values in target's Build Settings, could somebody explain that?
To read the full explanation see the Xcode Build Settings documentation, but in essence just note the reference to the intersection of the two architecture settings. Actual supported architecture will be the intersection of values (one or the other setting may be empty but not both or no binary will be output).

Related

Why this alert? "App installation failed, This application does not support this device’s CPU type" [duplicate]

When trying to build and install an application on an iPod running iOS 4.2.1, I'm seeing the error
This application does not support this device's CPU type
I'm trying to build the application using xcode 4.3, as well as xcode 4.4, and still seeing this. What can cause this and how can I fix it?
I have encountered such a problem today on iOS 11.2.1 with iPhone 7 devices.
The reason is that the previous project set up a 32-bit architecture that is no longer supported.
And I solved the problem as follows:
Project -> Build Settings -> Architectures value should be set Standard architectures - $(ARCHS_STANDARD)
From the project build settings -> Architectures, make sure you have both armv6 and armv7 values.
Also, you can check your Info.plist file, under Required device capabilities. If there's armv7 there, remove it.
If you are getting this error building Unity 3D application, change scripting backend to IL2CPP, and select "Universal" architecture.
This post led me to my answer. Thanks #adig and #masam
I have an iOS 8.4 enterprise signed app that would only work on certain device types when I tried to install it from our internal app store, and it was inconsistent. I wasn't getting any helpful error messages, even from the device console, until I tried to deploy it using the XCode Devices to a 5th gen iPod. It said "This application does not support this device type" which led me to here. I was debugging on a 6th gen iPod/iPhone 6.
I was archiving from a different scheme than I usually release from and I was only building the current architecture which meant that it would only work on a certain type of device depending on what was plugged in when I archived.
So make sure that "build active architecture only" is NO when you are archiving an app to sign as an Enterprise app.

Do we need to compile iOS App for both "armv7" and "arm64" if my deployment target is 8.0?

My App supports from iOS8.0 and above. And I know that from iOS7 onwards its arm64 bit architecture. In that case do we need to compile the binary for both "armv7" and "arm64" slices?
If I compile for arm64 alone, I can reduce my App size. Is it a right way ?
Please help.
Here you can find very easy to understand explanation of all iPhone and also Mac CPU architectures.
It helped me a lot when I decided to remove armv7 architecture from my supported architectures:
Choose carefully when excluding architectures. An application built with armv7 will run on all current iOS devices, even those that support newer architectures (it will run as 32-bit on iPhone 5S and later). But on the other hand, an app built without armv7 will not run on older devices such as the iPhone 4/4S or the original iPad mini.
As per my understanding from Apple docs, The size of App will be reduce when you compile it for specific architecture and it's the correct way of doing it.
Apple docs :
Target Fewer CPUs
By default, Xcode projects are configured to generate optimized copies
of your app in CPU-specific "slices" of your executable. Different
hardware will run a different slice of the executable. This enables
powerful optimizations that are only possible on some devices.
However, this can substantially increase the size of your app's
executable.
To target only specific CPUs, change the Architectures build setting
from Standard $(ARCHS_STANDARD) to a list of the names of specific
CPUs you want to support. Valid CPU names are listed in the Valid
Architectures (VALID_ARCHS) build setting. Do not change the Valid
Architectures setting. It is vestigial, and best managed by Xcode.
For more info refer this
You need to build the app for both of these

Make the app compatible with 32bit iOS devices, now only works for with 64bit devices

I just released a new version of my app and noticed that it says it's only compatible with iPhone 5s and later on the App Store, all of which run on 64bit processor. so my users with iPhone 5, 4s, and 4 won't be able to update the app.
I don't know if I changed anything unintentionally that has caused this, but I do want the users with 32bit architecture to be able to download the app.
as the picture below shows in my architectures I have armv7 and armv7s to support iPhone 4 and 5, so I don't know how to fix this issue.
on my info.plist I have,
I greatly appreciate your help.
Thanks!
Finally i found two links for your requirements
64 bit details
And check your minimum deployment target ,if its sets to 7.0 then the
xcode will do manage 64bit or 32bit .
also check this link
Build Active Architecture Only should be NO then you support 32 bit architecture as well.
When you archive your project please choose the Generic iOS Device, not any real devices.

"Deployment target" and "Architectures" for ios development

From the Apple Xcode Build Setting reference, we can see that :
iOS Deployment Target identifies the earliest iOS version the product is to run on
Architectures specifies the architectures (ABIs, processor models) to which the binary is targeted
What's the relationship between these two concepts? When I set build settings, they should be consistent?
For example, I want to target iOS 5. I think I need to find out all the devices which can run iOS 5 or later versions iOS, and collect all CPU architectures from these devices. Suppose there are three kinds of architectures from these devices: A,B,C. I should set the architecture to "A,B,C"? Or, if the oldest architecture is A, then I can assume backwards compatibility, set the architecture only to "A"?
Please correct me If my understanding is wrong. Thank you.
I know this is a little old but.
The iOS Deployment Target does exactly as the docs say.
The Architectures is basically a list of all the CPU architectures for which Xcode will compile your source.
If you have iOS 5 as your iOS Deployment Target and try to build & run your app on a device with iOS 6 but your Architectures list does not contain the CPU architecture of that device, you will get an error because your app hasn't been compiled to run on that CPU.
Hope that helps

Xcode 4.5 and iOS 4.2.1 incompatibility

The latest release notes indicates 4.2.1 and lower will not be supported, we now have to use 2 version of Xcode to develop when supporting older devices?? This is going to be difficult to support older devices if we want to develop iOS6 AND support 4.2 and lower.
I don't think Xcode 4.4 will support iOS6. So this is the issue. How would developers easily support these platform without so much hassle?
You can do this, but it requires some minor Xcode hacking, and some sacrifices. Depending on what you mean by "support iOS 6", this may or may not be sufficient for you. If you just want your app to run on iOS 6, then this should work. If you also need your app to incorporate new iOS 6 features, then it won't.
(Note for others who don't have a problem using multiple versions of Xcode: this similar question has answers that do allow you to also use new iOS 6 APIs and directly target armv7s)
See basic instructions on chpwn's blog here (but read the rest of this below, too!)
Basically, you can use Xcode 4.5 to build for iOS 4 and above, but then you can't take advantage of the new iOS 6 only features. So, you're really building for iOS 4 and 5, and assuming that the app will run fine on iOS 6 (which should be true, but you'll need to test this yourself).
You'll need to copy the iOS 5 SDK folder
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.*.sdk
from an old Xcode installation (which you'll need to keep around briefly, or reinstall to a non-standard location). You'll then set the Deploy Target in your Build Settings to iOS 4.0 (or whatever minimum OS you want). You may need to open the project.pbxproj file in a text editor to set this manually:
IPHONEOS_DEPLOYMENT_TARGET = 4.0;
You'll also need to set the Architectures to armv6 and armv7. You cannot directly also target armv7s. But, that doesn't mean your app won't run on iPhone 5. armv7 executables should run on iPhone 5, simply without any optimizations added in armv7s. It's just that compatibility doesn't work in the other direction (e.g. armv7 executables don't run on an armv6 iPhone 3G).
There's also a step that might be necessary, that's not mentioned in chpwn's blog. You may get these warnings (which really are errors, because Xcode won't generate your executable properly):
warning: no rule to process file '$(PROJECT_DIR)/main.m' of type sourcecode.c.objc for architecture armv6
In order to fix this, you'll need to setup a custom Build Rule for your target that tells Xcode to use LLVM GCC 4.2 to generate armv6 code. Define the rule for files matching the pattern *.[mc]:
This will be a different compiler than the Xcode default, and you may need to adjust some of the syntax in your Objective-C code. Even though many people wanting to do this probably wrote their apps before ARC, it is important to note that LLVM gcc 4.2 does not support ARC.
Finally, you probably will still see warnings from Xcode about iOS deploy targets less than 4.3, and armv6 not being supported. Those, I found, were not problems, and could be ignored:
Running lipo -info on my app executable after this shows the desired result:
lipo -info MyAppName
Architectures in the fat file: MyAppName are: armv6 armv7
Xcode 4.5 makes iOS 4.3 the earliest supported operating system, which effectively orphans the original iPhone and the 3G.
If you want to support iOS versions earlier than 4.3, you will need to keep around a 4.4 version of Xcode.
To be a bit clearer : you cannot easily (meaning Xcode does not out-of-the-box) support pre-4.3 devices and use iOS 6 features in the same app. That's because iOS 6 features require XCode 4.5 which also sets iOS 4.3 as the minimum supported OS.
So, you have 3 choices :
Continue using XCode 4.4. You'll be able to target pre-4.3 iOS. You won't be able to take advantage of iOS 6 features, but your app should run fine on it assuming you perform adequate testing on actual iOS 6 devices.
Migrate to XCode 4.5. You won't be able to target pre-4.3 iOS, but you'll be able to take advantage of iOS 6 features.
Make two versions your app. Build one version with XCode 4.4 (as in option 1), and the other with 4.5 (as in option 2). From the point of view of distribution, these will be 2 separate apps, they'll each have their own bundle ID, etc. You will have two entries in the app store.
If you are comfortable going beyond what is supported directly by Xcode, see Nate's answer.
The original iPhone and iPhone 3G are the only devices that don't support iOS 5. The iPhone 3G is now 4 years old. You may want to consider dropping support for iOS 4. If you don't want to do that, I think you'll have to develop in two different versions of Xcode.
I assume that the dropped support for iOS 4.2.1 is not the core problem. In fact, I tried to work around this and do the following:
Build the app with iOS 6 SDK, setting deployment target to iOS 4.2.1 (which works).
Pack the app for ad hoc installation and install the app on an iOS 4.2.1 device (iPod touch 2G).
Test the app.
However, installation fails. The reason here is - afaik - not the iOS version. The reason is the architecture. XCode 4.5 no longer allows you to build for armv6. It only builds for armv7. On the other hand: all device which have armv7 or better can run iOS 5. The only devices which do not support armv7 are iPhone, iPhone 3G, iPod touch 1G and iPod touch 2G.
So for me the question is: can you build for armv6 with XCode 4.5 and iOS 6 as base SDK?
Edit: Which you cannot do, because the iOS 6 base SDK is not available for armv6. Right?
Try to set the project settings manually using IPHONEOS_DEPLOYMENT_TARGET=4.0. However, I don't know if there is any side effect.
I think that targeting to 4.3 is the best choice, according to ios version statistics

Resources