问题描述
我想使用 MapBox Search SDK for iOS。所以我关注了this official documentation
首先,我在 /home 目录中创建了“.netrc”作为指令,然后添加这个 -
use_frameworks!
target "TargetNameForYourApp" do
pod 'MapBoxSearchUI',">= 1.0.0-beta.3","< 2.0"
end
到 podfile。然后运行 pod install 并在终端中得到这个 -
Analyzing dependencies
Downloading dependencies
Installing MapBoxCommon (9.0.2)
Installing MapBoxMobileEvents (0.10.8)
Installing MapBoxSearch (1.0.0-beta.4)
Installing MapBoxSearchUI (1.0.0-beta.4)
Generating Pods project
Integrating client project
[!] Please close any current Xcode sessions and use `MapBox.xcworkspace` for this project from Now on.
Sending stats
Pod installation complete! There is 1 dependency from the Podfile and 4 total pods installed.
[!] Automatically assigning platform `ios` with version `12.1` on target `MapBox` because no platform was specified. Please specify a platform for this target in your Podfile. See `https://guides.cocoapods.org/Syntax/podfile.html#platform`.
但是在运行完所有这些之后,我在 Xcode 中遇到了这个错误 -
Framework not found MapBoxCommon.xcframework
我也试过这个 -
pod deintegrate && pod cache clean --all
pod install
但还是一样的错误。
我想我已经正确地遵循了文档并正确输入了秘密 API 密钥。那么为什么我会收到此错误?
编辑:
在项目目标中未列出已安装的 pod -
但是在项目目录的 pod 文件夹中 -
还有其他可用的框架,这些框架在 Xcode Pods Target 中不可用。
这是否意味着项目中没有框架?
编辑:
- 我已经检查了我的项目目录是否存在 MapBox.common.xcfreamework。我在 pod/mapBoxCommon 文件夹下找到了那个文件
- 我一直在使用 MapBox.xcworkspace 打开我的项目,该文件是在运行 pod install 后生成的。
解决方法
您遇到此错误是因为您仍在尝试构建项目文件 (xcodeproj),而不是 CocoaPods 生成的工作区。
要解决此问题,请打开“MapBox.xcworkspace”文件并从现在开始使用该文件访问您的项目。