将AdobeMobileLibrary(适用于iOS)与cocoapods一起使用? [英] Use AdobeMobileLibrary (for iOS) with cocoapods?
问题描述
我们将使用iOS的Omniture-Tracking,它是AdobeMobileLibrary的一部分。
不能通过cocoapods-repo(仅旧版本的Omniture)提供AdobeAdobeMobileLibrary,但可以从Adobe网站下载它作为静态库。
我想知道是否可以用cocoapods维护这个静态库?
我创建了一个podspec文件:
Pod :: Spec.new do | s |
s.name ='AdobeMobileLibrary'
s.version ='4.0.2'
s.license ='Commercial'
s.summary ='Adobe Omniture SiteCatalyst分析库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文件:
pod'AdobeMobileLibrary',:path => 'AdobeMobileLibrary.podspec'
在Pods项目中,我可以看到所有文件(AdobeMobileLibrary.a, ADBMobile.h,ADBMobileConfig.json)
请参阅
http://i.stack.imgur.com/rnmp1.png
但是我无法构建项目并收到此错误消息:
ld:找不到-lAdobeMobileLibrary
有人知道吗,这是什么问题?
是否有其他解决方案可将AdobeMobileLibrary与cocoapods一起使用? / p>
问题是由于cocoapods期望库具有 lib 前缀,即在这种情况下为libAdobeMobileLibrary.a 。解决此问题的最简单方法是创建指向该库的符号链接:
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分析库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'}
结尾
We are going to use Omniture-Tracking for iOS, which is part of AdobeMobileLibrary. AdobeAdobeMobileLibrary is not available via cocoapods-repo (only an older version of Omniture), but as a static-library, that you can download from the Adobe Website.
I wonder if it is possible to maintain this static-library with cocoapods?
I've created a podspec-file:
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
In my podfile I reference the podspec-file like s this:
pod 'AdobeMobileLibrary', :path => 'AdobeMobileLibrary.podspec'
In the Pods-project I can see all the files (AdobeMobileLibrary.a, ADBMobile.h, ADBMobileConfig.json)
see http://i.stack.imgur.com/rnmp1.png
However I cannot build the project and receive this error message:
ld: library not found for -lAdobeMobileLibrary
Does anyone have a clue, what's the problem here?
Is there a different solution to use AdobeMobileLibrary with cocoapods?
The issue is due to cocoapods expecting the library to have a lib prefix, i.e. libAdobeMobileLibrary.a in this case. The easiest way to resolve this issue is to create a symbolic link to the library:
ln -s AdobeMobileLibrary.a libAdobeMobileLibrary.a
It's also worth noting that with the Adobe Mobile SDK, the .json file should be included as a resource not as source. Also you'll want to add references to both the SystemConfiguration framework as well as libSqlite3.0.dylib. Here's your pod spec modified accordingly:
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
这篇关于将AdobeMobileLibrary(适用于iOS)与cocoapods一起使用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!