iosframeworksweak-linking

Only weak link the frameworks which is not available in deployment target?


In my app, Most frameworks is weak linked. As I read the document, I consider that maybe I needn't weak-link these frameworks.

Setting of my app

My app's deployment target is iOS4.3 and the base SDK is iOS7.1.

My idea

In my app I use CIImage and UICollectionView. CIImage is in CoreImage framework which is available after iOS5.0, so I should weak-link CoreImage framework. UICollectionView is available in iOS6.0 in UIKit framework, but UIKit is available in iOS4.3, so I needn't weak-link UIKit framework.

Am I right ?


Solution

  • If you are using CoreImage and have not written any defensive code to account for the framework possibly not being present, you should always hard link the framework.However, since CoreImage is only available in iOS 5 and later, you must weak link the framework if you want your app to run on iOS 4.3. But, you really do need to write the defensive coding of checking to ensure the class is present at run time, or simply not calling the CoreImage methods when the app is running on iOS 4.3.

    With that said, you really don't need to support iOS 4.x. The iOD market upgrades very quickly.As a result, it might just not be worth it to put the effort in to support 4.x.