在iOS模拟器4.2/4.3上运行应用程序时出现以下错误。在iOS 5上运行正常。

dyld: Library not loaded: /System/Library/Frameworks/Accounts.framework/Accounts
  Referenced from: /Users/User/Library/Application Support/iPhone Simulator/4.3/Applications/FBFD053F-E816-4114-AFEB-D90A6A67259B/SampleApp.app/SampleApp
  Reason: image not found

我在我的应用程序中使用AssetsLibrary和OpenCV框架。
我没有弄错原因。

最佳答案

您收到此错误的原因是Accounts.framework仅在iOS 5.0或更高版本中可用。因此,您将无法在iOS 4.2/4.3上运行它。

您也可以将Accounts.framework标记为可选。在Xcode中,选择“目标”>“构建阶段”>“与二进制库链接”>“Accounts.framework”,并将其标记为可选。

另外,请确保在iOS 4.3中跳过此代码(需要iOS 5.0或更高版本的代码)。您可以使用以下代码进行检查:

NSString *reqSysVer = @"5.0";
NSString *currSysVer = [[UIDevice currentDevice] systemVersion];
if ([currSysVer compare:reqSysVer options:NSNumericSearch] != NSOrderedAscending) {

     //Add any code that requires iOS 5.0
}

关于iphone - dyld : Library not loaded:/System/Library/Frameworks/Accounts.框架/帐户,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/10912737/

10-13 08:08