react-native iOS报错Library not found for -lRNAppleAuthentication如何解决
react-native iOS 编译报错
Library not found for -lRNAppleAuthentication 解决方案 注意:不要删除
Library Search Paths中的$(inherited)配置项,该配置用于继承CocoaPods生成的编译规则,删除会导致大量Pod依赖无法被正常识别,请先将该配置项恢复到原有位置。
- 确认依赖安装完整
检查项目根目录package.json是否存在@invertase/react-native-apple-authentication依赖,缺失则执行对应安装命令:
npm安装:npm install @invertase/react-native-apple-authentication --save
yarn安装:yarn add @invertase/react-native-apple-authentication
RN版本低于0.60的项目需额外执行手动link:react-native link @invertase/react-native-apple-authentication,0.60及以上版本无需手动link。 - 重新安装Pod依赖
执行以下命令清理旧Pod缓存并重新安装:
安装完成后必须关闭当前Xcode窗口,双击项目ios目录下后缀为cd ios rm -rf Pods Podfile.lock build pod deintegrate pod install --repo-update cd ...xcworkspace的文件启动项目,禁止使用.xcodeproj格式文件打开项目,否则无法识别Pod生成的依赖库。 - 检查链接配置
打开Xcode后进入项目Target →Build Phases→Link Binary With Libraries,检查列表中是否存在红色标记的libRNAppleAuthentication.a文件,存在则选中删除后重新编译;如果完全没有该文件,可手动将Pods目录下对应的RNAppleAuthentication静态库添加到列表中。 - 统一架构配置
如果是模拟器运行时报错,进入项目Target →Build Settings→Excluded Architectures,确认模拟器配置没有单独排除arm64架构,与CocoaPods的生成配置保持一致。如果问题依然存在,可以在Podfile末尾添加以下配置后重新执行pod install:post_install do |installer| installer.pods_project.targets.each do |target| target.build_configurations.each do |config| config.build_settings['ONLY_ACTIVE_ARCH'] = 'NO' end end end
内容的提问来源于stack exchange,提问作者Lahiru Amarathunge
相关产品推荐
相关产品推荐

