如何解决由于 LocalAuthentication.framework 而导致的 "Library not loaded" 错误?

How to solve "Library not loaded" error because of LocalAuthentication.framework?

我可以在 IOS 8 中成功 运行 我的应用程序,但在 IOS 7 中,我的应用程序崩溃了。

留言是:

dyld: Library not loaded: /System/Library/Frameworks/LocalAuthentication.framework/LocalAuthentication
  Referenced from: /Users/burakkilic/Library/Developer/CoreSimulator/Devices/A0210158-BC6C-43AA-9D85-AA8DE6115AAA/data/Applications/xxx
  Reason: no suitable image found.  Did find:
/System/Library/Frameworks/LocalAuthentication.framework/LocalAuthentication: mach-o, but wrong architecture

我该如何解决?

您可以 weak link LocalAuthentication.framework 并在运行时有条件地访问 LocalAuthentication API。

后者可以通过以下任一方式完成:

  1. 正在检查您 运行 的 iOS 版本。
  2. 使用反射来测试是否存在 API 方法(respondsToSelector,等)。