我想更新应用程序中内置的 CocoaPods,因此我从终端运行
pod install
。
那就是我收到此错误的时候:
[!] The `APP_NAME [Debug]` target overrides the `FRAMEWORK_SEARCH_PATHS` build setting defined in `Pods/Target Support Files/Pods/Pods.debug.xcconfig'. This can lead to problems with the CocoaPods installation
- Use the `$(inherited)` flag, or
- Remove the build settings from the target.
如何使用 $(inherited) 标志?
选择项目、目标 -> 应用程序,然后
Build Settings
我添加了 $(inherited) 行,删除之前引用的任何特定 pod:
我也遇到这个问题了
除了执行 Peter 上面提到的操作之外,请记住仔细检查 podfile 中是否选择了正确的 Xcode 项目。这是因为您可能正在更改不正确的 Xcode 项目的构建设置。这是一个愚蠢的错误,但我花了很长时间才意识到。
通常,如果目录中只有一个
pod install
文件,.xcodeproj
会自动工作。但是,如果您要从手动将框架/第 3 方项目添加到 Xcode 项目的旧方式迁移项目以开始使用 cocoapods,则文件夹中可能会有多个 .xcodeproj 文件。执行上述修复并没有为我解决问题,因为我正在编辑不正确的 .xcodeproj
文件。
转到您的项目目录,检查名为
Podfile
的文件,并确保指定 xcodeproj
:
# Uncomment this line to define a global platform for your project
# platform :ios, '8.0'
# Uncomment this line if you're using Swift
use_frameworks!
xcodeproj 'APP_NAME.xcodeproj'
target 'APP_NAME' do
# Your dependencies here
# pod 'NAME_OF_DEPENDENCY'
pod 'Google/CloudMessaging'
pod 'RxSwift', '~> 2.0'
pod 'RxCocoa', '~> 2.0'
pod 'RxBlocking', '~> 2.0'
pod 'Fabric'
pod 'Crashlytics'
pod 'FBSDKCoreKit'
pod 'FBSDKLoginKit'
pod 'FBSDKShareKit'
在 Podfile 上选择正确的
.xcodeproj
后,转到 Xcode 并执行以下操作:
Build Settings
$(inherited)
作为值;它应该自动填充评估该表达式的数据下面是 Xcode 版本 7.2 (7C68) 的图像。
在旧的 Ionic 3 项目上将 cordova-onesignal 从 v2 更新到 3.3.0 时,我遇到了同样的问题(错误构建:找不到框架 Pods_xxx)。
这为我解决了这个问题:
在 Xcode 中,导航“项目”+“目标”+“常规”+ 向下滚动到“框架”、“库”和“嵌入式内容”
在列表中,我只是删除了(列表底部的减号)相关文件 Pods_xxx.framework(它有点灰显)
重建后一切正常(包括 OneSignal)
如果我执行 pod install,它会回来,我必须重新做一遍。
这对我也有帮助!但是当我运行 pod install 库时,搜索路径会被覆盖。 所以我为 podfile 做了一个钩子,也许它会对某人有所帮助
project_path = './yourProject.xcodeproj'
project = Xcodeproj::Project.open(project_path)
project.targets.each do |target|
if target.name == 'yourProjectTarget'
target.build_configurations.each do |config|
config.build_settings['LIBRARY_SEARCH_PATHS'] = ['$(inherited)']
end
end
end
project.save
每次运行 pod install 时,此挂钩都会将 LIBRARY_SEARCH_PATHS 覆盖为 $(inherited)。 将其放入 post_install Podfile 块中