Learning to Code for Older Devices

I am a newbie to Swift/Objective-C and I am really confused about (the two) languages, devices, and iOS versions. I can't figure out what I should be learning! I know Swift (2.0) is the language of the future and iOS 9 is presumably the OS of the near future. Still, as an amateur, people I'm coding for include some with iPhone 4's (iOS 7) and iPad 2's (iOS 8, maybe not upgraded any further). I'd like to write code they also can use. ... Will I be able to do this with Xcode 7 (if I set the Build Target low enough)? Should I just find an older version of Xcode? If an app runs OK on iOS 7, will it be OK on later iOS's (assuming I include different sized graphics)? ... Or do I basically just have to decide--learn Swift 2 and target new devices or learn older Objective-C and target "legacy" OS's?

Answered by RLKingSoftware in 49165022

There is no guarantee that any app written using current tools will work properly in future devices

nor future iOS versions. Lot's of apps were broken simply by the transision from iOS 7 to 8 and

again from 8 to 8.4. Many more, are currently broken as shown by the many complaints about

various apps on iOS 9 and OSX El Capitan betas.


If you do not need to support iOS prior to 7, Swift should be fine. If you do need to support lower

versions, you cannot use Swift.

Xcode 7 supports iOS deployment targets all the way back to iOS 6, so you're safe in that respect. Since you're using the latest developer tools, you don't need to worry about the compatibility issues because you can write code to deal with individual iOS versions you might encounter.


Now about the languages: both Obj-C and Swift are compiled in the same manner, so you're welcome to learn whichever one you want because it makes literally no difference in the compiled, finished product. My recommendation, though, is to learn Swift.

Except that Swift only works with iOS 7 and later.

Accepted Answer

There is no guarantee that any app written using current tools will work properly in future devices

nor future iOS versions. Lot's of apps were broken simply by the transision from iOS 7 to 8 and

again from 8 to 8.4. Many more, are currently broken as shown by the many complaints about

various apps on iOS 9 and OSX El Capitan betas.


If you do not need to support iOS prior to 7, Swift should be fine. If you do need to support lower

versions, you cannot use Swift.

Thank you for responding ... Does your response (combined with bob133's) imply if I use current tools (xcode7) and code in Obj-C (rathern than Swift) and make my build target iOS 6 then I could make simple apps that'll run OK on iOS 6-8 devices?

Yes. Keep in mind, under xCode 7 there have been a lot, hundreds in fact, of changes

to the APIs. In the past, deprecated meant is planned for removal and will stop working

in future. Now, deprecated means, no longer works. So, if you find you need an API

that has been deprecated, you're pretty much out of luck using xCode 7. My advice,

use xCode 6 if you're still using Yosemite.

Very helpful. I _think_ I understand. Does this sound right? ... If I learn Obj-C with materials a couple years old (as they all are) I risk learning deprecated API's that won't work in xcode7. But if I write code that builds OK in xcode7 (even having set a lower deployment target) I run the risk of creating apps that won't actually work in the older OS's.

Hold on a minute—just because the CNCopySupportedInterfaces function has been removed and access denied to its replacement (you've seen the brouhaha in the forums about "get current wifi ssid," right?) doesn't mean this is the way things are happening now. That was an exception, not the rule. Tons of other stuff got deprecated, yet they continue to work. Now don't get me wrong—you're still not supposed to be using them now, but the world won't end if you have older code or code that needs to run on older iOS versions. If you use Xcode 7, then you should be able to get the best of both worlds. API deprecation is almost always not something you need to lose sleep over.

There are many APIs that were deprecated and simply don't work in xCode 7 Bob. Some that

still work, deliver unreliable results and some, simply return nil just like CNCopySupportInterfaces.

If this were not the case, so many apps would not be broken by iOS 9 alone.


Acolburn,

You will have to perform version checks and make sure the API you want to use is available in

the iOS version it's running on. This is the danger of supporting older devices and iOS versions

simply because, as Apple makes changes, they often toss out perfectly good technology for

no other reason than expediency. This is why they are so pro everyone updating to the latest

iOS/OSX all the time. Less support headaches and less legacy code to support overall.

Can you provide any other examples? I should think that if an API were suddenly pulled, you and I would hear about it in the forums, but the only one I've seen was CNCopySupportedInterfaces. I'm still not convinced.


However, I totally agree with you about the version checking and avoiding deprecated APIs in versions with a replacement.

Are you sure ? Just try for. the past few days, xcode7 will not deploy to anything below IOS 8, I have tried on both testflight and. Ad hoc mode

Learning to Code for Older Devices
 
 
Q