使用时use_frameworks
!在Cocoapods中的说明中,在Swift中导入Objective-C Pod不需要桥接头。
只需将所需的pod设置到podfile中:
#Uncomment this line to define a global platform for your project
platform :ios, '9.0'
#Uncomment this line if you're using Swift
use_frameworks!
target 'YourProject' do
#Swift Pods
pod 'Alamofire'
pod 'ActiveLabel'
#ObjC Pods
pod 'IDMPhotoBrowser'
pod 'Firebase'
#This stuff is to set the SWIFT_VERSION
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['SWIFT_VERSION'] = '2.3'
end
end
end
end
运行pod install
。运行pod update
(这不是必需的,但是由于某种原因,即使是在全新安装之后,我几乎每次都得到更新)。关闭Xcode,然后使用白色xcworkspace
文件重新打开。
import Alamofire
import ActiveLabel
import IDMPhotoBrowser
import Firebase
做完了
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句