由于最近开发一个项目,需要用到百度地图API,于是使用pod添加了百度地图的库,podfile如下:
# Uncomment the next line to define a global platform for your project
# platform :ios, '11.4'
target 'BaiduLocTest' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for BaiduLocTest
pod 'BMKLocationKit','1.2.1'
pod 'BaiduMapKit','4.1.1'
pod 'SnapKit','~>4.0.0'
target 'BaiduLocTestTests' do
inherit! :search_paths
# Pods for testing
end
target 'BaiduLocTestUITests' do
inherit! :search_paths
# Pods for testing
end
end
新建桥接文件-配置桥接文件路径-import头文件,报错:找不到头文件,如下图:
文件目录的确是有对应的头文件的。
于是找到百度地图的demo看了一下,发现import头文件的前缀不是BaiduMapKit,而是BaiduMapAPI_XXX。打开pods/BaiduMapKit才发现里面出了头文件还有一个framework文件夹,而里面放的就是编译出来的.framework文件,文件名正好对应前缀。于是找到要用头文件所属framework,用framework名作前缀就没问题了。