iphone – dyld:未加载库:/System/Library/Frameworks/Accounts.framework/Accounts

前端之家收集整理的这篇文章主要介绍了iphone – dyld:未加载库:/System/Library/Frameworks/Accounts.framework/Accounts前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我在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中,选择Targets>构建阶段>链接二进制库> 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
}

猜你在找的Xcode相关文章