Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Recommended way to support backward/forward compatibility in iPhone app?

I'm in the early stages of an iPhone app and I have a question. I did some searching but did not find what I was looking for.

There are features in iPhone OS4 that I would like to take advantage of, but I would like for my app to also run on 3.X.

It looks like I want to develop against the 4.0 SDK and do the following:

  1. Create a "weak link" to any new (4.0) frameworks
  2. Call respondsToSelector: for any new method in an existing framework or any method in a new framework before making that call

Am I close? What's recommended?

Pointers to similar questions welcome.

UPDATE: Just as a note - if you are trying to check for a new framework, you're best chance is to call respondsToSelector: on a class method against the class object instead of using an instance method.

like image 398
Thompsonian Avatar asked Jun 02 '10 00:06

Thompsonian


People also ask

Are iOS App backward compatibility?

Backward compatibility property allows the app to use the interface of its older version. If the developers have used several tools for both backward and forward compatibility of your iOS app, it will fail to work with the new iOS 13. For that reason, and the app update is essential.


1 Answers

Yes, that's exactly how you do it!

The only other trick I can think of that you have not already mentioned is that you build against the latest SDK (i.e., 4.0 in this case) and set the target to be the earliest you want to support (3.0 in this case).

You might like to try using the 3.2 SDK to create a universal (iPhone/iPad) app. This is an Apple template that uses this same method to work with two different APIs.

like image 186
Stephen Darlington Avatar answered Sep 28 '22 08:09

Stephen Darlington