我有一个只包含Objective-C pod的podfile,如下所示:
source 'https://github.com/CocoaPods/Specs.git'
target "myProject" do
pod 'GoogleMaps'
pod 'GooglePlaces'
pod 'GooglePlacePicker'
pod 'GoogleMaps'
pod 'RMMapper'
pod 'Parse'
pod 'Mapbox-iOS-SDK'
pod 'PocketSVG', '~> 0.7'
pod 'Fabric'
pod 'Answers'
pod 'lottie-ios'
end
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['SWIFT_VERSION'] = '3.0'
end
end
end
和一个看起来像这样的bridiging标题:
#import <Parse/Parse.h>
#import <GoogleMaps/GoogleMaps.h>
#import "PocketSVG.h"
#import <Lottie/Lottie.h>
现在,我想添加Alamofire,这是一个Swift pod。所以我必须使用use_frameworks!
,我的podfile如下所示:
source 'https://github.com/CocoaPods/Specs.git'
target "myProject" do
pod 'GoogleMaps'
pod 'GooglePlaces'
pod 'GooglePlacePicker'
pod 'GoogleMaps'
pod 'RMMapper'
pod 'Parse'
pod 'Mapbox-iOS-SDK'
pod 'PocketSVG', '~> 0.7'
pod 'Fabric'
pod 'Answers'
pod 'lottie-ios'
pod 'Alamofire' # Added
use_frameworks! # Added
end
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['SWIFT_VERSION'] = '3.0'
end
end
end
但是当我尝试构建项目时,我遇到了2个错误:
第一个是我的桥接标题:
&#39; PocketSVG.h&#39;找不到文件
第二个不在特定文件上:
无法导入桥接标头
我知道如何解决它?
答案 0 :(得分:1)
use_framework
将使pod文件中指定的lib链接为动态库。您应该使用#import <PocketSVG/PocketSVG.h>
或@import PocketSVG;
答案 1 :(得分:-1)
试试这个
并将以下文本放在该podfile中
target 'Myproject' do
platform :ios, '10.0'
use_frameworks!
pod 'GoogleMaps'
pod 'GooglePlaces'
pod 'GooglePlacePicker'
pod 'GoogleMaps'
pod 'RMMapper'
pod 'Parse'
pod 'Mapbox-iOS-SDK'
pod 'PocketSVG', '~> 0.7'
pod 'Fabric'
pod 'Answers'
pod 'lottie-ios'
pod 'Alamofire'
end
无需添加额外的行 之后只需输入命令pod install 我希望它能奏效!