"Deployment target" and "Architectures" for ios development - ios

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

Related

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

How does my app work in iOS simulator if architecture is set to arm?

My build settings has "architecture" option set set several arm versions. That means after compilation and linking I should get fat binary for several ARMs.
But how then it works in my iOS simulator which is x86 based?
Xcode will always build your app for x86_64 when you change the target to be the simulator, your choice of VALID_ARCHITECTURE have no impact on this.

Error creating LLDB target at path, Xcode 6 GM seed

I'm getting this error whenever I build in Xcode 6 GM Seed. It seems to be making my app insanely slow. What exactly does this mean and how do I fix it?
I had the following error:
Warning: Error creating LLDB target at path '.....'- using an empty
LLDB target which can cause slow memory reads from remote devices.
PS: im not able to run my app, its stuck on the splash screen
There is a thread in the Apple Developer Forum, https://devforums.apple.com/message/1010068#1010068 that describes how to diagnose this issue. I had his issue for Xcode 6 GM Seed, specifically - Version 6.0.1 (6A317). This isn't necessarily a solution, but it may help some people get a better diagnosis
Useful steps are as follows -
1) Create or modify your ~/.lldbinit and add log enable -f /tmp/lldb-api.txt lldb api to it.
2) Rerun your debugger session (no need to restart Xcode or anything)
3) Inspect the file at /tmp/lldb-api.txt. Look for a line beginning with SBDebugger::CreateTarget(...). Mine looked something like this
SBDebugger(0x7f83671fd600)::CreateTarget
(filename="/Users/xxxxxxx/Library/Developer/Xcode/DerivedData/Dino-gjuxikhuyokkqufeqmesmgjcxylu/Build/Products/Debug-iphonesimulator/Dino.app",
triple=x86_64, platform_name=(null), add_dependent_modules=1,
error=the specified architecture 'x86_64' is not compatible with
'i386-apple-ios' in
'/Users/xxxxxxx/Library/Developer/Xcode/DerivedData/Dino-gjuxikhuyokkqufeqmesmgjcxylu/Build/Products/Debug-iphonesimulator/Dino.app/Dino')
=> SBTarget(0x0)
4) Inspect the target file from the above log output, in my case -
file
"/Users/xxxxxxx/Library/Developer/Xcode/DerivedData/Dino-gjuxikhuyokkqufeqmesmgjcxylu/Build/Products/Debug-iphonesimulator/Dino.app/Dino"
/Users/apanagar/Library/Developer/Xcode/DerivedData/Dino-gjuxikhuyokkqufeqmesmgjcxylu/Build/Products/Debug-iphonesimulator/Dino.app/Dino:
Mach-O executable i386
5) So, In my case my problem was the architectures I was building for. The target architecture for your project should match the one on the SBDebugger::CreateTarget() line in the log output.
Xcode doc's point out the following. I had to go through my nested frameworks and change some outdated architecture targets -
NOTE ABOUT 64-BIT ARCHITECTURE
An app extension target must include the arm64 architecture in its
Architectures build settings or it will be rejected by the App Store.
Xcode includes this architecture with its “Standard architectures”
setting when you create a new app extension target.
If your containing app target links to an embedded framework, the app
must also include the arm64 architecture or it will be rejected by the
App Store.
For more information about 64-bit development, see 64-Bit Transition
Guide for Cocoa Touch or 64-Bit Transition Guide for Cocoa, depending
on your target platform.
https://developer.apple.com/library/ios/documentation/General/Conceptual/ExtensibilityPG/ExtensionCreation.html#//apple_ref/doc/uid/TP40014214-CH5-SW1
I am not sure if this will help in your case. But I tried this solution and it worked pretty neatly for me.
Pull up the terminal and type - rm -rf ~/Library/Developer/Xcode/DerivedData
This is supposed to remove the huge stack of DerivedData folder and make the app execute faster.
Did you use Architectures=$(ARCHS_STANDARD_32_BIT) and run your app on a 64 bit device? (iPhone 5S or iPhone 5S simulator)
Apple seems to be stricter with apps which don't support 64bit. So if there is no specific reason, I think it's better to include arm64 in your build architecture
NOTE ABOUT 64-BIT ARCHITECTURE
An app extension target must include the arm64 architecture in its
Architectures build settings or it will be rejected by the App Store.
Xcode includes this architecture with its “Standard architectures”
setting when you create a new app extension target.
If your containing app target links to an embedded framework, the app
must also include the arm64 architecture or it will be rejected by the
App Store.
For more information about 64-bit development, see 64-Bit Transition
Guide for Cocoa Touch or 64-Bit Transition Guide for Cocoa, depending
on your target platform.
Source:
https://developer.apple.com/library/prerelease/ios/documentation/General/Conceptual/ExtensibilityPG/ExtensionCreation.html#//apple_ref/doc/uid/TP40014214-CH5-SW1
This warning is solved by changing Build Settings :
Select Project -> Build Settings
Change 'Architectures' to 'Standard architectures (armv7, arm64) - $(ARCHS_STANDARD)'
This will prompt an alert stating iOS 5.1.1 and above are supported. Click 'Change Deployment Target to 5.1.1'
Repeat steps for Target (if not changed automatically)
Also, this is preferred build setting since Apple is forcing developers to build apps on 64 but architecture. Apple document Link

Xcode 5: about 64-bits architecture and backwards compatibility

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

Why is armv6 a Valid Architecture for iOS 5?

Can someone tell me why creating a new project with an iOS Deployment Target of iOS 5.0 includes armv6 as a Valid Architecture in Project > Build Settings by default? The default info.plist file only lists armv7 in the Required Device Capabilities.
As I understand it, if I am building for iOS 5 or later that will only run on armv7 devices (i.e. iPhone 3GS or later, iPod 3G or later, and the iPads). Thus I should be able to remove all the armv6 references, and set Build Active Architecture Only to YES.
Can anyone confirm or clarify? Thanks.
XCode v4.3.2, Base SDK 5.1, iOS Deployment Target iOS 5.0, iPhone Device Family
PS - I understand that removing armv6 will reduce the size of the binary.
$(VALID_ARCHS) defines the set of architectures that an Xcode target supports. $(ARCHS) tells Xcode what architectures to build. What actually gets built for each target is the intersection of $(VALID_ARCHS) and $(ARCHS).
$(VALID_ARCHS) is typically used to avoid building a target for some architecture that the project as a whole otherwise supports. If you don't need to do that, you can safely ignore it.

Resources