我正在尝试将我的代码包装到一个 CocoaPod 库中(作为 SDK 外部使用),但我遇到了一些问题(我是新手,所以如果它没有多大意义,我很抱歉)。基本上我正在使用 3 个 pod(Alamofire、MobilePlayer 和 SwiftEventBus),如果我有本地文件可以使用,最后 2 个会很棒,因为我正在对其进行一些修改。我这样做对吗?以及如何“安装”这些依赖项以在我的代码上使用它(不是示例,而是我的 Classes/*swift 本身)?
我已经尝试过这个 .podspec ,但是当我运行时它给了我一些 sintax 错误pod spec lint --verbose
:
-> SambaPlayerSDK.podspec - 错误 | 规格:SambaPlayerSDK.podspec
无法加载中定义的规格。
[!] 无效SambaPlayerSDK.podspec
文件:语法错误,意外 =>,预期关键字_end s.dependency = 'MobilePlayer',:local => 'library/mobileplayer-ios' ^ SambaPlayerSDK.podspec:41:语法错误,意外 =>,预期关键字_end ...y = 'MobilePlayer', :podspec => 'library/mobileplayer-ios/Mo... ... ^ SambaPlayerSDK.podspec:42: 语法错误,意外 =>,期待关键字_end s.dependency = 'SwiftEventBus' , :local => 'library/SwiftEventBus' ^ SambaPlayerSDK.podspec:43: 语法错误,意外 =>,期待 keyword_end ... = 'SwiftEventBus', :podspec => 'library/SwiftEventBus/Swift ... ... ^。更新 CocoaPods 可能会解决此问题。
s.platform = :ios, '8.0'
s.requires_arc = true
s.source_files = 'Pod/Classes/**/*'
s.resource_bundles = {
'SambaPlayerSDK' => ['Pod/Assets/*.png']
}
# s.public_header_files = 'Pod/Classes/**/*.h'
# s.frameworks = 'UIKit', 'MapKit'
# s.dependency 'AFNetworking', '~> 2.3'
s.dependency = 'Alamofire', '~> 3.0'
s.dependency = 'MobilePlayer', :path => 'library/mobileplayer-ios'
s.dependency = 'MobilePlayer', :podspec => 'library/mobileplayer-ios/MobilePlayer.podspec'
s.dependency = 'SwiftEventBus', :path => 'library/SwiftEventBus'
s.dependency = 'SwiftEventBus', :podspec => 'library/SwiftEventBus/SwiftEventBus.podspec'
感谢您的帮助 =)