Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How does an app with lower base sdk work?

In XCode I can specify Base SDK. I am wondering how does that work behind the scenes? If I am running an app, for example, on a device that has iOS 7 and my base SDK is iOS 6, then how come the app has the old 'look and feel'? Does XCode compile the older SDK and include it within my app or does new version of iOS comes with older libraries/SDKs?

In other words, does the run time know this app is compiled with lower base SDK and somewhere in UIKit's code it does:

if (lower SDK) {
  //show old look/feel
} else {
  //show new look/feel
}

or does the app itself include the old library and load it ?

Thanks

like image 438
0xSina Avatar asked Sep 12 '13 04:09

0xSina


People also ask

What is base SDK in Xcode?

Base SDK is the SDK you link against. Deployment Target is the minimum required iOS version you application needs to run. You can build an application with SDK 7 that runs under iOS 6.

What is an app SDK?

A software development kit (SDK) is a set of tools that provides a developer with the ability to build a custom app which can be added on, or connected to, another program. SDKs allow programmers to develop apps for a specific platform.

Can you use multiple SDKs?

Shorter answer: yes, additional SDKs can be placed in the Xcode bundle.

What does iOS SDK do?

The iOS SDK (iOS Software Development Kit), formerly the iPhone SDK, is a software development kit (SDK) developed by Apple Inc. The kit allows for the development of mobile apps on Apple's iOS and iPadOS operating systems. Apple Inc. The iOS SDK is a free download for users of Macintosh (or Mac) personal computers.


2 Answers

iOS applications are forward compatible with new versions of iOS. The reason is :

Almost all changes to the iOS versions are additive and hence an application build using lower version still runs on the higher iOS version.

Though, we need to take care of this point:

As frameworks evolve through various releases, APIs are introduced or deprecated and behaviors of existing APIs may occasionally change. Apple makes every effort to minimize changes that may cause incompatibilities, in some cases providing alternate behaviors based on the framework version. In rare cases, your code needs to determine the framework version and adjust accordingly

To understand more, read this

like image 78
Puneet Sharma Avatar answered Oct 29 '22 01:10

Puneet Sharma


Apple never changes / deletes / renames classes or methods. They only add new ones.
If they don't want you to use it anymore, they mark it as deprecated.

This is a very important point.
At compile-time, the compiler checks if all classes and method signatures are available in the SDK your building your app with.

If that's the case, you can build and deploy your app. Because those classes and methods will never be deleted from newer versions of the framework, your app will run just fine.


On the other hand, you can build apps and deploy them to systems, which do not actually support the current SDK. For example, you can use Autolayout (NSLayoutConstraint class is available since 10.7) and deploy it for Mac OS X 10.6. The compiler will not say a word.

The app will crash though on systems prior to 10.7.

like image 20
IluTov Avatar answered Oct 29 '22 02:10

IluTov