Xcode构建时AQPlayer库加载失败,已配置Podfile为何仍报错?
解决Xcode中AQPlayer.framework加载失败问题
错误信息
Library not loaded: @rpath/AQPlayer.framework/AQPlayer Referenced from: <EDD8756F-B150-3DA7-9592-394B9104E7F3> /Users/test/Library/Developer/CoreSimulator/Devices/E7444FA1-2434-45B0-AD48-F7CDEE04E7A8/data/Containers/Bundle/Application/2A652B8F-49BF-4235-8B1D-A72D2A53A7F1/test.app/test
你的Podfile内容
# Uncomment the next line to define a global platform for your project platform :ios, '13.0' target 'test' do # Comment the next line if you're not using Swift and don't want to use dynamic frameworks use_frameworks! # Pods for Minuteapp pod 'SwiftMessages' pod 'GoogleSignIn' pod 'Promises' pod 'Flurry-iOS-SDK/FlurryMessaging' pod ‘Flurry-iOS-SDK/FlurrySDK’ pod 'ApphudSDK' pod 'FittedSheets' pod 'ColorThiefSwift' pod "SwiftChart" pod 'SDWebImage' pod 'AQPlayer' pod 'STPopup' pod 'Toast-Swift' pod 'PaddingLabel' pod 'GoogleSignIn' pod 'DeviceKit' # pod 'SwiftyStoreKit' pod 'ReachabilitySwift' pod 'Amplitude' pod 'OneSignal/OneSignal', '>= 5.0.0', '< 6.0' pod 'OneSignal/OneSignalInAppMessages', '>= 5.0.0', '< 6.0' # If your app does not use CoreLocation, you can remove this: pod 'OneSignal/OneSignalLocation', '>= 5.0.0', '< 6.0' end post_install do |installer| installer.pods_project.targets.each do |target| target.build_configurations.each do |config| config.build_settings['ONLY_ACTIVE_ARCH'] = 'YES' end end installer.generated_projects.each do |project| project.targets.each do |target| target.build_configurations.each do |config| config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '13.0' end end end end
排查与解决步骤
1. 修复Podfile语法错误
你的Podfile中pod ‘Flurry-iOS-SDK/FlurrySDK’使用了中文单引号,这会导致CocoaPods解析异常,替换为英文单引号:
pod 'Flurry-iOS-SDK/FlurrySDK'
2. 彻底重建Pods环境
- 终端执行
pod deintegrate移除现有Pods集成 - 删除项目目录下的
Podfile.lock文件和Pods文件夹 - 执行
pod install重新安装依赖 - 确保后续打开的是
test.xcworkspace而非test.xcodeproj
3. 验证Framework嵌入配置
- 打开Xcode项目的
General标签页,找到Frameworks, Libraries, and Embedded Content - 检查AQPlayer.framework是否在列表中,且
Embed选项设置为Embed & Sign - 如果不在列表中,点击
+按钮,选择Add Other→Add Files,找到Pods/AQPlayer/AQPlayer.framework添加后设置Embed方式
4. 检查Build Settings路径配置
- 打开项目Build Settings,搜索
Framework Search Paths - 确认路径中包含
$(inherited)和${PODS_ROOT}/AQPlayer,缺失则手动添加
5. 清理缓存并重启
- 按下
Cmd + Shift + K清理项目 - 按下
Cmd + Option + Shift + K清理构建文件夹 - 关闭Xcode后重新打开工作区,再次尝试构建
内容的提问来源于stack exchange,提问作者Rue Vitale
相关产品推荐
相关产品推荐

