Xcode 11.5,iOS 13.5
我创建了一个简单的Xcode项目,然后使用CocoaPods进行了初始化,因此初始步骤是:
pod init
TestCocoa.xcworkspace
此后,我创建了新的Framework(BestAPI)并作为第二个项目(与原始TestCocoa项目一起)添加到原始工作区中。所以现在我的TestCocoa.xcworkspace
有2个项目。在Podfile中,我仅为BestAPI项目添加了Alamofire
并将其导入到swift文件中。但是当我尝试构建项目时,出现此错误:
Cannot load underlying module for 'Alamofire'
我试图清理项目pod deintegrate
等,但没有任何效果。我尝试添加use_frameworks !,但是在这种情况下,我可以构建项目,但是在运行该项目时,我会遇到另一个错误:
dyld: Library not loaded: @rpath/Alamofire.framework/Alamofire
这是我的Podfile:
use_modular_headers!
workspace 'TestCocoa.xcworkspace'
testCocoa = 'TestCocoa.xcodeproj'
bestAPI = 'BestAPI/BestAPI.xcodeproj'
project testCocoa
project bestAPI
target 'TestCocoa' do
project testCocoa
target 'TestCocoaTests' do
inherit! :search_paths
# Pods for testing
end
target 'TestCocoaUITests' do
# Pods for testing
end
end
target 'BestAPI' do
project bestAPI
pod 'Alamofire'
target 'BestAPITests' do
inherit! :search_paths
# Pods for testing
end
end
一些截图: