ios5 backward compatibility - ios

A quick curiosity.
If I develop an application with ios 5(e.g core audio kAudioUnitSubType_AudioFilePlayer) components and set the deployment target to ios 4 will the ios 5 components work on an ios 4 device?

Since nobody can travel back in time, you cannot use iOS 5 features on iOS 4.
However, you can write an app that runs fine on iOS 4 and uses iOS 5 features if available. For example, you can ask a class whether it implements a method using respondsToSelector:, and if so, you can call it.
With kAudioUnitSubType_AudioFilePlayer, you can simply try to initialize the audio unit with AUGraphNewNode but on iOS 4 you will get an error (but not a crash).

An application running on iOS 4.x only has access to the APIs available in the 4.x frameworks.

I'd recommend for new apps, as of today... that you develop for iOS 5 using iOS 5 features. After you are done, do some regression testing on iOS 4. Whatever is broken, re-write, or allow the app to do something different at runtime (you can check if an object would respond to a method before calling it ;)). This will allow you to use all the sweet iOS 5 stuff with the least 'settling'. My team created some of the new features in iOS 5 IN iOS 4 (dealing the the navigation controller) so that the code would require very little change.

Related

How can I achieve backward compatibility from iOS 10 to iOS 8?

The app I developed (with Swift 3 and xcode 8) is ready for iOS 10, but my boss wants it to work with iOS 8 because he has an iPhone with 8.2: when I plugged his iPhone to my Mac and started to build the project, it failed because some features are available only on iOS 9.0 or higher.
I did some research and came across some options, but since I'm a beginner I don't know what would be better. Let me share them with you:
rewrite the whole app with Objective-C: I think the less convenient, since I never studied this language and my boss wants the app to be uploaded to the store as soon as possible;
call Obj-C code from Swift for iOS 8 needs;
upload the app anyway: I managed to modify the app and make it compatible with iOS 9, do you know any recommendation or proposal from Apple to not develop app for too much old iOS versions so that I can convince my boss to not obsess over this matter? 87% of devices are using iOS 10 so we would not cut off too many people;
upload the app AND add iOS 8.0 compatibility in a future update: can I change iOS target in next updates?
use Appcelerator or React Native.
The best solution would be to check the iOS version programatically and only call the problematic methods if the user's phone actually supports them. Otherwise keep that functionality hidden from the user.
This is how you can check iOS version from code:
if #available(iOS 9, *) {
// iOS 9 Swift code
} else {
//Hide the methods from the users on older OS versions
}
That wouldn't work, since most system APIs are not language dependent. If a certain API/feature was only added in a certain iOS version, that requirement stays the same regardless of whether you use Objective-C or Swift.
Same as 1.
This is a feasible option of course.
AFAIK, you can change the target iOS version in a later update.
If you want to achieve a functionality that uses an API which was only introduced in iOS9, even hybrid frameworks need that iOS version if they use built-in iOS APIs.
To add iOS 8 compatibility you must change the deployment target version to 8.0 and resolve every warning/issue that Xcode give you when you try to build/run.
You will need to use if #available(iOS 9, *) {} code if you use APIs that changed between the versions 8 and 10.
You don’t need to rewrite anything in objective c. For the features that are getting called out, research the iOS 8 compatible way to implement them (if even possible) and add checks in your code for iOS version so that certain blocks only execute for certain os’s. (See technical answers already provided)
But, first show your boss how to update his phone.
Then show your boss that 97% of users are using 9 or 10.
https://developer.apple.com/support/app-store/
Next remind him that the 3% of out of date users are also the 3% least likely to be downloading apps and only part of that 3% are on iOS 8. Many are even more out of date.
Then calculate the number of hours required to support iOS 8. Multiply that by your hourly rate. Then ask your boss if it’s worth $X to expand your app’s user base by, at best,1%.
If he says yes, then go for it.

Which minimum iOS version should my app support if creating BLE app?

I am about to start new application and my customer want to support iOS 5 and iPhone 5 also including all latest range devices. I am using swift and official apple doc saying it supports till iOS 7. My app will going to work based on BLE and location update data and basically its a IOT application.Issue is should i start giving support from iOS 7 or 5 or from 9? I do not have any exact clue why I should not choose iOS 7 version and I should start iOS 9.
You can start by checking the device capability table here:
https://developer.apple.com/library/content/documentation/DeviceInformation/Reference/iOSDeviceCompatibility/DeviceCompatibilityMatrix/DeviceCompatibilityMatrix.html
As it states there, the first device compatible with Bluetooth Low Energy is iPhone 4s.
With that in mind you could possibly support the first iOS version which supports iPhone 4s, from here it is iOS 5. As others mentioned Core Bluetooth was introduced a bit later.
Now you should understand that supporting all versions starting from such an old OS version will introduce A LOT of work. Then you have 2 questions which we cannot answer:
Do you want to do that work?
Is your customer willing to pay for it?
As for link for your customer I guess you could use this:
https://mixpanel.com/trends/#report/ios_10
I would say that Mixpanel is quite a big company which tracks iOS distribution numbers pretty precise.
The facetious reply - nonetheless a valid one - is to find another client.
A more rational reply is to speak reasonably to your client with confidence and knowledge of history.
1 iOS underwent a major UI change with iOS 7, what's to be gained by supporting something older?
2 If the device in question is actually running iOS 5 today it probably cannot use iOS 8 or above.
3 As you said, Swift will not run on a device unless it's iOS 7 and above.
4 The historical adoption rate for the next version of iOS - since I believe the start of history in 2007 - is well above 80% in the first year and 90% the year after.
Combining these things, you have several arguments for this client. (And yes, this question and/or answer likely belongs in the freelancing site.)
1 Why the need for iOS 5?
Give them the current numbers of how many devices currently still run iOS 5. Have them defend this reason, or else find another client.
2 If the client is "closed", meaning they aren't looking to market your code, then why are they using devices running iOS 5?
Again, the only reason to use that old a version - understanding that a device running iOS 5 is old enough yet likely new enough to at least run iOS 7 - is that they are cash-strapped. Frankly, that's a client I'd run from. Quick.
3 There's two likely reason for this request. (a) They are testing you to see how you reply. (b) They are not as informed as you about the current state of the iOS market.
Let's take the the latter one first. Be informed and knowledgable and stick with the facts. Use the arguments I lined out above. If they aren't convinced - you probably need to drop them as a client. While the "customer rules", nobody wants a client you cannot reason with.
As for the former - the client is testing you?
Again, give them the facts - you can support iOS5, but with limitations - later versions of iOS may not run those devices, later features introduced in iOS (particularly UI things like auto layout, UICollectionViews, etc.) mean extreme complications in the code base... adding both time and money, and it needs to be written in Objective-C.
iOS 5?! Right now iOS 9 has 92% of active devices so you should definitely choose it or even iOS 10.
For BLE as you mentioned iOS 7 and iPhone 4S is minimum.
You can see from the Documentation that Core Bluetooth was introduced in iOS 5, so you can target that version and still have BLE support but only in Objective-C
However, there will be a number of other enhancements in iOS that you will not be able to take advantage of and this will make development more difficult Andre therefore more expensive.
iOS 5 is very old and probably represents a very small percentage of devices.

Will iOS Application created in XCode 7.2 with SDK 9.2 be compatible with iOS 6 in iPhone 4?

If i create an iOS application in XCode 7.2 with SDK 9.2, will that application work in iOS 6 in iPhone 4?
In general, this is possible - that is where the availability information in the apple documentation comes into play.
You may use iOS 6 as your deployment target and only use the API available on iOS 6.
This will mean your code completion on the current Xcode will suggest unavailable methods and you will be very limited in terms of what the API can do for you.
Also, to cherry pick one of the problems you might run into:
iOS 6 has a whole different approach to authorization for location usage than iOS 9, so you would have to (partly) clutter your code with a lot of version checks to give different implementations for the different versions (and version checks were not available back then). Because, a iOS 9 device will not even ask the user for permissions if you do it the way iOS 6 documentation says you have to do it.
The very fact that you do ask this question might already give away that in general, the answer is
Yes, that can be done with a lot of work that is almost intractable for a single person and in almost all cases not needed.
as the market share of iOS 6 is only a tiny fraction, but in your case, the answer might even be
You will probably fail horribly at some point and should reconsider if this is really necessary. The market share of iOS 6 is really small and you are basically putting in weeks of extra work for basically a hand full of potential users.
Also, as you might have guessed from this (and other answers), if your question is if this works out of the box, the answer is
No.
in general yes or no terms.. yes it is possible.
(Our app spans between 7 and 9)
Supporting ios6 will require a lot of work though since you must take care not to use any features that aren't available on ios6 and iOS sdk6 and iOS sdk9 differ quite a bit :)
I'd consider if it is worth the effort.

Xcode 5//iOS 6 and 7//TDD: OCUnit or XCTest

I am a software engineering student enrolled in a practicum course where a small team of students works with a third-party client to solve a problem. My team has been assigned a project that involves writing an iOS program. None of us have ever done any iOS programming. We are reading voraciously, but need to come up to speed as quickly as possible since the semester is only 15 weeks long.
My question is regarding testing frameworks. Our team plans to use TDD. Our iOS app needs to support iOS 6 and 7. I thought I read somewhere that XCTest only supports iOS 7 and that we will need to use OCUnit in order to support iOS 6. Is that true? How do we write an app that supports both iOS 6 and 7? Is it as simple as setting the deployment target to iOS 6.0 and not using any APIs that were introduced after iOS 6.0?
You can target iOS 6 and up, but if you use XCTest, you will be able to run your tests only on iOS 7.
I believe you can use still use XCTest, but I would urge you to take a look at Kiwi (https://github.com/allending/Kiwi) in your research. It basically wraps whichever framework you choose (xctest/octest) with macros to give you a spec-style testing option. Also, it has extremely powerful mocking/stubbing support which is essential in unit testing.

Submitting iOS 5 apps during the transition to iOS 6

Has Apple made any announcement as to how long they will accept apps built using the iOS 5 SDK (as opposed to the new iOS 6)?
No, and they don't tend to make any such announcements.
That said, you'd normally build against the iOS 6 SDK and simply set a deployment target of 5.0. Numerous bug fixes usually occur in the compiler-side part of the SDK between releases that don't relate to new features.
The legacy simulators will allow you to continue to test appropriately directly on your computer and obviously you can continue to connect up a real iOS 5 device.
The real question is when Apple will stop accepting 5.x deployment targets for the App Store. As they still accept 4.0 now I suspect that'll be a while.

Resources