我正在编写一个Swift框架和一个Swift iOS应用程序,我正在尝试使用Cocoapods将我的框架添加到我的应用程序和其他sdks中。
这是我的swift框架的podspec
Pod::Spec.new do |s|
s.name = "InfraCocoa"
s.version = "0.0.1"
s.summary = "A short description of InfraCocoa."
s.license = "MIT"
s.author = { "" => "" }
s.platform = :ios
s.ios.deployment_target = "7.0 "
s.source_files = "Classes", "Classes/**/*.{swift,h,m}"
end
我的iOS应用程序的pod podfile
target 'CocoaProjectTest' do
pod 'InfraCocoa', :path => '~/Documents/workspaces/CocoaPodsTesting/Infra/InfraCocoa'
pod 'CrashlyticsFramework', '2.2.5.2'
pod 'GoogleTagManager', '3.09'
pod 'Google-Mobile-Ads-SDK', '7.0.0'
pod 'Facebook-iOS-SDK', '3.23.0'
pod 'AFNetworking', '2.5.1'
end
现在,如果我运行'pod install'或'pod update',一切正常。问题是当我尝试构建Xcode(6.1.1)时。我得到一个编译错误,说这样的东西 “_sqlite3_close”,引自:
-[TAGDataLayerPersistentStoreImpl closeDatabase] in libGoogleAnalyticsServices.a(TAGDataLayerPersistentStoreImpl.o)
(maybe you meant: _fbdfl_sqlite3_close)
经过一些谷歌搜索后,我发现这是因为我的GoogleTagManager缺少库中的“libz.dylib”和“libsqllite3.dylib”,其中包含“Link Binary With Libraries”。我可以手动添加它们,但它会编译,虽然这不是理想的。
我决定在我的podfile中没有以下行进行测试并编译
pod 'InfraCocoa', :path => '~/Documents/workspaces/CocoaPodsTesting/Infra/InfraCocoa'
我认为这可能是因为库版本存在冲突,但是这个InfraCocoa框架完全干净且空洞(做了一个File-> New-> Project - > CocoaTouch Framework)。
有什么想法吗? (应用程序项目也是空的和干净的)
答案 0 :(得分:2)
我认为您可以覆盖PodFile中的GoogleTagManager.podspec,只需在修改后的文件版本中添加缺少的库。
类似的东西:
pod 'GoogleTagManager', :podspec => './GoogleTagManager.podspec.json'
并在podspec中:
"libraries": ["GoogleAnalyticsServices", "sqlite3", "z"],
似乎正在使用cocoapods 0.36.rc.1