ld:安装 pod 后找不到框架
ld: framework not found after pod install
我将 Firebase 库添加到我的项目中,然后出现此错误。当我编译它时,Xcode 找不到一些目录。但是,它们位于 Pods 目录中。
这是错误日志:
ld: warning: directory not found for option '-F/Users/Erumaru/Library/Developer/Xcode/DerivedData/ToDoTogether-gkzytezmbbgkikgoxjpptxgrixil/Build/Products/Debug-iphonesimulator/GTMSessionFetcher'
ld: warning: directory not found for option '-F/Users/Erumaru/Library/Developer/Xcode/DerivedData/ToDoTogether-gkzytezmbbgkikgoxjpptxgrixil/Build/Products/Debug-iphonesimulator/GoogleToolboxForMac'
ld: framework not found GTMSessionFetcher
clang: error: linker command failed with exit code 1 (use -v to see invocation)
这是我的 Podfile:
# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'
target 'ToDoTogether' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
platform :ios, '10.0'
pod 'Firebase'
pod 'Firebase/AdMob'
pod 'Firebase/Auth'
pod 'Firebase/Crash'
pod 'Firebase/Database'
pod 'Firebase/Analytics'
pod 'Firebase/Messaging'
pod 'Firebase/RemoteConfig'
pod 'Firebase/Storage'
# Pods for ToDoTogether
end
确保您打开的是工作区文件而不是项目文件。我收到了同样的错误,并意识到我使用的是项目而不是工作区。
转到项目目标 > 构建设置:
查找搜索路径 > 框架搜索路径,删除所有警告过的路径;然后在库搜索路径中,删除所有警告过的路径。
我遇到了同样的问题,我尝试了多种方法,但仍然无法正常工作。我在下面试过。
- 使用 XCworkspace 文件
- 清理了项目,重新启动了 XCode、Mac
- 将位码改为否
- 删除了框架、库的搜索路径
最后起作用的是,删除 pod 文件并重新创建 pod 文件。它就像魔术一样奏效!
P.S.: 这是非常普遍的错误,因此相同的解决方案可能不适用于所有人。
对我来说,我必须 change/edit 架构并选择新架构。
我已将 debug
架构重命名为 debug(development)
,这导致了我的问题。
修复:
Product > Edit Schema > Change Build Configuration
我所做的是创建备用 Configurations
并重命名我当前的。
在我的情况下,我只需要转到 Edit Scheme > 运行 并重新选择 "None" 作为可执行.
我将 Firebase 库添加到我的项目中,然后出现此错误。当我编译它时,Xcode 找不到一些目录。但是,它们位于 Pods 目录中。
这是错误日志:
ld: warning: directory not found for option '-F/Users/Erumaru/Library/Developer/Xcode/DerivedData/ToDoTogether-gkzytezmbbgkikgoxjpptxgrixil/Build/Products/Debug-iphonesimulator/GTMSessionFetcher'
ld: warning: directory not found for option '-F/Users/Erumaru/Library/Developer/Xcode/DerivedData/ToDoTogether-gkzytezmbbgkikgoxjpptxgrixil/Build/Products/Debug-iphonesimulator/GoogleToolboxForMac'
ld: framework not found GTMSessionFetcher
clang: error: linker command failed with exit code 1 (use -v to see invocation)
这是我的 Podfile:
# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'
target 'ToDoTogether' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
platform :ios, '10.0'
pod 'Firebase'
pod 'Firebase/AdMob'
pod 'Firebase/Auth'
pod 'Firebase/Crash'
pod 'Firebase/Database'
pod 'Firebase/Analytics'
pod 'Firebase/Messaging'
pod 'Firebase/RemoteConfig'
pod 'Firebase/Storage'
# Pods for ToDoTogether
end
确保您打开的是工作区文件而不是项目文件。我收到了同样的错误,并意识到我使用的是项目而不是工作区。
转到项目目标 > 构建设置:
查找搜索路径 > 框架搜索路径,删除所有警告过的路径;然后在库搜索路径中,删除所有警告过的路径。
我遇到了同样的问题,我尝试了多种方法,但仍然无法正常工作。我在下面试过。
- 使用 XCworkspace 文件
- 清理了项目,重新启动了 XCode、Mac
- 将位码改为否
- 删除了框架、库的搜索路径
最后起作用的是,删除 pod 文件并重新创建 pod 文件。它就像魔术一样奏效!
P.S.: 这是非常普遍的错误,因此相同的解决方案可能不适用于所有人。
对我来说,我必须 change/edit 架构并选择新架构。
我已将 debug
架构重命名为 debug(development)
,这导致了我的问题。
修复:
Product > Edit Schema > Change Build Configuration
我所做的是创建备用 Configurations
并重命名我当前的。
在我的情况下,我只需要转到 Edit Scheme > 运行 并重新选择 "None" 作为可执行.