swift3 – Cocoapods | podspec将GoogleAnalytics添加为依赖项

swift3 – Cocoapods | podspec将GoogleAnalytics添加为依赖项,第1张

概述我正在尝试将GoogleAnalytics添加为我的podspec中的依赖项,如下所示: s.dependency "GoogleAnalytics" 我当然得到: The ‘Pods-****’ target has transitive dependencies that include static binaries: (****/Pods/GoogleAnalytics/Libraries @H_419_0@ @H_419_0@ 我正在尝试将GoogleAnalytics添加为我的podspec中的依赖项,如下所示:

s.dependency "GoogleAnalytics"

我当然得到:

The ‘Pods-****’ target has transitive dependencIEs that include static binarIEs: (****/Pods/GoogleAnalytics/librarIEs/libGoogleAnalytics.a)

由于谷歌并不打算给他们的pod动态版本,我试图通过在podspec中添加source_files / public_header_files / vendored_frameworks来添加它:

s.subspec 'GoogleAnalytics' do |sp|  sp.source_files =    'Pods/Google/headers/*.h','Pods/Google/headers/Moduleheaders/*.h','Pods/FirebaseAnalytics/Frameworks/frameworks/FirebaseAnalytics.framework/headers/*.h','Pods/FirebaseInstanceID/Sources/*.h','Pods/FirebaseInstanceID/Frameworks/frameworks/FirebaseInstanceID.framework/headers/*.h','Pods/GoogleInterchangeUtilitIEs/Frameworks/frameworks/GoogleInterchangeUtilitIEs.framework/headers/*.h','Pods/GoogleSymbolUtilitIEs/Frameworks/frameworks/GoogleSymbolUtilitIEs.framework/headers/*.h','Pods/GoogleToolBoxForMac/*.h','Pods/GoogleToolBoxForMac/Foundation/*.h','Pods/GoogleToolBoxForMac/Foundation/*.m','Pods/GoogleAnalytics/librarIEs/*.a','Pods/GoogleAnalytics/Sources/*.h'  sp.ios.public_header_files  =    'Pods/Google/headers/*.h','Pods/FirebaseInstanceID/Source/*.h','Pods/GoogleAnalytics/Sources/*.h'  sp.ios.vendored_frameworks =    'Pods/Google/Frameworks/GGLAnalytics.framework','Pods/Google/Frameworks/GGLCore.framework','Pods/FirebaseAnalytics/Frameworks/frameworks/FirebaseAnalytics.framework','Pods/FirebaseCore/Frameworks/frameworks/FirebaseCore.framework','Pods/FirebaseInstanceID/Frameworks/frameworks/FirebaseInstanceID.framework','Pods/GoogleInterchangeUtilitIEs/Frameworks/frameworks/GoogleInterchangeUtilitIEs.framework','Pods/GoogleSymbolUtilitIEs/Frameworks/frameworks/GoogleSymbolUtilitIEs.framework'end

我在我的项目中得到类似的东西:

pod“MyPod”

我在我的BrIDging-header中有这个:

#import <GGLCore/GGLCore.h>#import <GGLAnalytics/GGLAnalytics.h>#import "GAI.h"#import "GAIDictionaryBuilder.h"#import "GAIEcommerceFIElds.h"#import "GAIEcommerceProduct.h"#import "GAIEcommerceProductAction.h"#import "GAIEcommercePromotion.h"#import "GaifIElds.h"#import "GAILogger.h"#import "GAITrackedVIEwController.h"#import "GAITracker.h"

我尝试在AppDelegate中执行此 *** 作:

// Configure tracker from GoogleService-Info.pList.    var configureError:NSError?    GGLContext.sharedInstance().configureWithError(&configureError)    assert(configureError == nil,"Error configuring Google services: \(configureError)")        let gai = GAI.sharedInstance()        gai?.trackUncaughtExceptions = true  // report uncaught exceptions        gai?.logger.logLevel = GAILogLevel.verbose  // remove before app release

我仍然收到以下错误:

“_OBJC_CLASS_$_GAI”,referenced from:
objc-class-ref in AppDelegate.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command Failed with exit code 1 (use -v to see invocation)

有没有人试过这样做?你成功了吗?谢谢

解决方法 与libGoogleAnalytics.a库链接为我解决了这个问题.

目标 – >构建阶段 – >链接二进制文件库,
从PathToGoogleAnalyticsFolder / GoogleAnalytics / librarIEs /添加文件

或者在你的podspec中

s.dependency "GoogleAnalytics"s.librarIEs = 'GoogleAnalytics',(any other librarIEs)s.pod_target_xcconfig = { 'liBRARY_SEARCH_PATHS' => '$(SRCROOT)/GoogleAnalytics/librarIEs/' }

当然你可能不得不改变这条道路,但我希望这会有所帮助!

@H_419_0@ 总结

以上是内存溢出为你收集整理的swift3 – Cocoapods | podspec将GoogleAnalytics添加为依赖项全部内容,希望文章能够帮你解决swift3 – Cocoapods | podspec将GoogleAnalytics添加为依赖项所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/1016827.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-23
下一篇 2022-05-23

发表评论

登录后才能评论

评论列表(0条)

保存