iOS 6 APIs and backwards compatibility - ios

Can I use APIs and Frameworks introduced in iOS 6 in an app that supports earlier iOS versions?
Is this only possible through workarounds and code such as:
[[UIDevice currentDevice] systemVersion]
Or would I be able to use updated frameworks, APIs, etc. in an app that supports earlier versions of iOS without specifying the version?
And also, would I be able to use Xcode 4.5, or would I have to stick to the current public release?

You can't ship an app that uses iOS 6 features at all until the OS and toolchain go final. (Update: The iOS 6 OS and SDK are now final.)
At that point, you should use the iOS 6 SDK and set your deployment target to an earlier version of iOS 5. You will not check the system version, but rather weak link the new frameworks, and test for the presence of specific classes or methods before using them, etc.
One extra wrinkle is that with the iOS 6 tools and SDK you can no longer support armv6 devices. You can support the iPhone 3GS and later, as well as every model of the iPad, but not the iPhone 3G and the original iPhone. But even with a legacy app, you shouldn't be targeting these anymore.
References:
SDK Compatibility Guide: "Read this document if you want your application to target a specific version or multiple versions of iOS or Mac OS X."

Related

Xcode 11.3.1 compatibility

I am building an IOS app on XCode 11.3.1 using Swift and would like to know which Iphone models will be compatible with the app. The simulator shows Iphone 8 and above. Does it mean that lower Iphones will not be able to run it?
I can't find a good explanation or a link.
The Xcode version is not the key to supporting older iPhones and their OSes.
Instead, look out for your deployment target. The lower you choose, the more ‘old’ iPhones you get. For example, if you choose iOS 8 as your deployment target, your app will support older devices that can use iOS 8 but not 13.
The simulator only shows a list of devices that supports the newest iOS version supported by the current version of Xcode, but may not necessarily mean that it is limited to those.
Do note that newer APIs be used for the older devices, though you could still make it such that it will work for newer devices, with a fallback to some older APIs just for the older devices.

How do I set a previous base SDK in Xcode 10?

In earlier versions of Xcode I could set the base SDK to the current iOS version and the deployment target to an earlier version as shown in the below slide from the iOS 7 TechTalk, session Architecting Modern Apps, Part 2:
This Stack Overflow question elaborates nicely on the Base SDK vs Deployment target.
What's the meaning of Base SDK, iOS deployment target, Target, and Project in xcode
However, now when I look at the base SDK config field in Xcode I just see "iOS" (which is an alias of "iphoneos").
According to https://developer.apple.com/ios/submit/
Starting March 2019, all iOS apps submitted to the App Store will need
to be built with the iOS 12.1 SDK or later, and support the all-screen
design of iPhone XS Max or the 12.9-inch iPad Pro (3rd generation).
This worries me because it seems that I can no longer target older versions of iOS.
I've done a lot of research by I cannot seem to work out definitively whether there still a way to use the 12.1 SDK but target older versions of iOS. Is there a way to do this?
The base SDK is just "iOS". The exact version will depend on your version of Xcode (12.1 if you are using Xcode 10.1). The base SDK does not determine which versions of iOS are supported by your app.
You set the minimum version your app is compatible with by specifying the "iOS deployment target", either for your project as a whole:
or in the settings for a specific target in your project
The oldest version of iOS that you can target with Xcode 10 is iOS 8 (which is pretty old).
BTW, you can see or select the Base SDK you are using, in the Xcode Preferences/Locations:

Delphi 10.1 berlin multiple ios SDKs

I have latest delphi and xcode etc running iphone sdk 10.2. Is there a way to setup a new platform and build to say ios 9? My list of sdks only shows 10.2. Not sure about supporting olders phones etc
You do not need to install earlier versions of SDK. The application compiled with Delphi Berlin will work at all versions of iOS, as stated in Options/Delphi Compiler/Linking/Minimum iOS version supported.
FMX library will work with iOS API 8..10 (there are some checks for version in source code - look for "TOSVersion.Check"). So as long as you will not use any extra iOS API "by hand", it will work for all devices running iOS 8..10. It is also possible, that basic applications will work for earlier versions, but it is of course unsupported.
For iOS 10 remember about extra security-related settings: http://docwiki.embarcadero.com/PlatformStatus/en/Main_Page
Summary: you do not need separate SDK nor extra version of the app for different iOS versions.
Remark about iOS development: in fact, xcode 8 also limits the target to iOS>=8, while you can setup it regardless of SDK in the project options in range 8..10. It is possible to force xcode 8 to compile and link against iOS 7 devices, but it is very hard to test and deploy, thus useless.

Can a 4th generation iPod touch run an app developed using the iOS 7 SDK?

After a recent question of mine (https://apple.stackexchange.com/q/116029/7742), here is some info:
My app was developed using Xcode 5, iOS SDK 7. Deployment target is 4.3.
I was told that the 4th generation iPod touch can't run iOS 7.
Since my app has a deployment target of 4.3, then it should run on that iPod, right? Or does the fact that I used the SDK 7 mean that it won't work?
iPod Touch, 4th Gen DOES NOT support iOS 7. See this Wikipedia article.
You CAN use Xcode 5 to build an App with a deployment target of 4.3, but that means you CANNOT use any iOS feature supported only by versions of iOS > 4.3. And you will have to be VERY CAREFUL to check that you don't, or the App WILL crash.
And... unfortunately there is no Profiler or Pre-Processor that warns... although you can double check if Xcode "Analyze" warns you. Else you just have to very carefully check all your code for conformity with the limitations of the 4.3 SDK or test a lot... well actually do both.
A deployment target means that the should work on devices running that deployment target iOS version (or later). (So, if your deployment target was 4.3 and the device is running an iOS version of 4.3 or greater, you should be fine.) The fact that you used Xcode 5 and the iOS 7 SDK will not affect this. The only limitation is that we cannot use the latest compiler to build for iOS versions prior to 4.3 and/or the first or second generation hardware.
Clearly this assumes that you didn't accidentally reference any classes or methods that require later iOS version (or if you decided to avail yourself of new features, that you put in runtime checks to only use those new methods/features if they were available). Try running your app on an iOS 6.0 simulator to confirm compatibility with iOS 6. (Note, Xcode 5 no longer includes the simulators prior to iOS 6.0, so if you really want to test against earlier versions, such as iOS 5.0 or 4.3, you might just want to get your hands on some old device with that older iOS version.)
I mention getting an older device, because compatibility with the old iOS version is not enough. You want to ensure your app can run on that hardware (e.g. doesn't require more than the 4th gen 256mb of memory, cellular, etc.). You really should find yourself physical hardware with older iOS versions upon which you can test your app.

Confused about iOS 5 SDK Capabilities vs iOS 5 Capabilities of the Device

I am unclear on how to tell if a new feature of iOS 5 requires iOS version 5 running on the device or if the feature can be obtained simply by compiling with the iOS 5 SDK.
ARC is an example. I understand if it supported under the iOS 5 SDK on devices that have not upgraded to iOS 5. Where is the documentation that tells me what SDK features require iOS 5 on the device?
You should always use the newest SDK as base SDK in your application. You can always target older iOS version with the "Deployment Target" setting, but you have to pay attention which new features you can use.
For example, iOS 5 brings two interesting new features, namely ARC and storyboards. You can use ARC if your deployment target is iOS >= 4.0, with the exception of weak references, which unfortunately do not work with iOS4. Storyboards are different, they need iOS 5, they won't work at all on older devices!
If you're using the newest XCode 4, you have to do some extra work to fully support iOS 4 or older versions. This is because the armv6 code generation has been deleted from all templates. Newer devices use the armv7 instruction set, but you can compile your application so that it targets both the armv6 and armv7 instruction set. See my other post on this topic.
Generally you can build application using iOS SDK 5, which will be working on older iOS.
The build settings of every project have two different parameters, which define base SDK and iOS Deployment Target.
This first defines which SDK do you use to build your app. Second is the minimum iOS version which is required for your application.
When you build this application, you should pay attention to not use any function / object which are newer then your deployment target, because compilator and linker can allow to use it, and application will crash on devices.
Of course Apple Docs always contains information about minimum iOS version, which is required by an object. Every new version always contains change log, containing changes from previous version.
Examples:
Description of iOS 5 SDK
iOS 5 Release Notes

Resources