构建使用CoreImage的应用程序并在iOS4上禁用它的功能

MB.*_*MB. 1 ios4 ios ios5

我有一个适用于iOS4的应用程序.我想添加iOS5(CoreImage)的新功能,并为iOS4用户禁用它们.我不想放弃对iOS4的支持.

虽然我可以测试功能,但是一旦我添加CoreImage框架,应用程序甚至不会在iOS4上构建.它崩溃了:

dyld: Library not loaded: /System/Library/Frameworks/CoreImage.framework/CoreImage
  Referenced from: /var/mobile/Applications/2EC8DC28-B109-48AD-8DEA-CC2DF1977C9C/App.app/App
  Reason: image not found
Run Code Online (Sandbox Code Playgroud)

添加CoreImage时,有没有办法在iOS4上运行应用程序?

mat*_*way 6

您需要设置CoreImage为弱链接.从"Link Binary with Libraries"构建阶段,将"Required"切换为"Optional"旁边的"Optional" CoreImage.framework.

哦,显然是对您的应用进行编码,以便在iOS 4上它不使用来自CoreImage的任何API,或者更一般地,使用iOS 5中引入的任何API.