0

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 ?

KudoCC
  • 6,912
  • 1
  • 24
  • 53
  • Why do you have deployment target iOS 4?... – Lord Zsolt Jun 08 '14 at 10:45
  • @LordZsolt Well, I don't want to support iOS4.x, but my employer want to support it. – KudoCC Jun 08 '14 at 11:43
  • You should tell your employer that over 93% of devices have iOS7 on them. The rest of the devices are either devices for which Apple doesn't provide support (anything iPhone 4 or under) or they belong to old people who use their phone only for calling. Now with iOS8 in beta, there's REALLY not reason to provide support for iOS5 or below. And once iOS8 is out, even providing support for iOS6 will be a time waste. – Lord Zsolt Jun 08 '14 at 16:52
  • @LordZsolt I agree with you, thanks. – KudoCC Jun 08 '14 at 22:59

1 Answers1

1

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.

kamprath
  • 2,220
  • 1
  • 23
  • 28
  • How about UIKit in my case, I am using `UICollectionView` which is available in iOS6.0, should I hard link UIKit ? I have written defensive code to make sure UICollectionView is available before using it. – KudoCC Jun 08 '14 at 11:47
  • @KudoCC Since UIKit has been around from the beginning, you are safe to hard link it. However, as you already point out, not all of it's methods are available in all version of the OS, so you have to check for the method's existence. For frameworks, you should consider weak linking them only if there is an older OS version you intend to support that doesn't have the framework altogether. `CoreImage` is an example of this if you intend to support iOS 4.x. – kamprath Jun 08 '14 at 19:38