gpt4 book ai didi

swift - 使用 Swift 的 iOS 8 中的 Google Analytics 不起作用

转载 作者:IT王子 更新时间:2023-10-29 05:53:08 26 4
gpt4 key购买 nike

我已经整合了Google Analytics library到我的项目。

然后我配置了 bridging header file并且我添加了以下 header Google Analytics

#import "Libraries/GoogleAnalytics/GAI.h"
#import "Libraries/GoogleAnalytics/GAIFields.h"
#import "Libraries/GoogleAnalytics/GAILogger.h"
#import "Libraries/GoogleAnalytics/GAITracker.h"
#import "Libraries/GoogleAnalytics/GAIDictionaryBuilder.h"

AppDelegate.swift 中库的初始化编译并正确运行。我添加以下代码来跟踪事件

var tracker = GAI.sharedInstance().defaultTracker
tracker.send(GAIDictionaryBuilder.createEventWithCategory(category, action: action, label: label, value: value).build())

尝试生成构建时,出现以下错误

Undefined symbols for architecture x86_64:
"_NSOverwriteMergePolicy", referenced from:
-[GAIDataStore contextWithModel:URL:] in libGoogleAnalyticsServices.a(GAIDataStore.o)
"_NSSQLiteErrorDomain", referenced from:
-[GAIDataStore performBlockAndWait:withError:] in libGoogleAnalyticsServices.a(GAIDataStore.o)
"_NSSQLiteStoreType", referenced from:
-[GAIDataStore coordinatorWithModel:URL:] in libGoogleAnalyticsServices.a(GAIDataStore.o)
"_OBJC_CLASS_$_NSAttributeDescription", referenced from:
objc-class-ref in libGoogleAnalyticsServices.a(GAICoreDataUtil.o)
"_OBJC_CLASS_$_NSEntityDescription", referenced from:
objc-class-ref in libGoogleAnalyticsServices.a(GAIDataStore.o)
objc-class-ref in libGoogleAnalyticsServices.a(GAICoreDataUtil.o)
"_OBJC_CLASS_$_NSFetchRequest", referenced from:
objc-class-ref in libGoogleAnalyticsServices.a(GAIDataStore.o)
"_OBJC_CLASS_$_NSManagedObjectContext", referenced from:
objc-class-ref in libGoogleAnalyticsServices.a(GAIDataStore.o)
"_OBJC_CLASS_$_NSManagedObjectModel", referenced from:
objc-class-ref in libGoogleAnalyticsServices.a(GAICoreDataUtil.o)
"_OBJC_CLASS_$_NSPersistentStoreCoordinator", referenced from:
objc-class-ref in libGoogleAnalyticsServices.a(GAIDataStore.o)
"_SCNetworkReachabilityCreateWithName", referenced from:
_kDefaultReachabilityApi in libGoogleAnalyticsServices.a(GAIReachabilityChecker.o)
"_SCNetworkReachabilityScheduleWithRunLoop", referenced from:
_kDefaultReachabilityApi in libGoogleAnalyticsServices.a(GAIReachabilityChecker.o)
"_SCNetworkReachabilitySetCallback", referenced from:
_kDefaultReachabilityApi in libGoogleAnalyticsServices.a(GAIReachabilityChecker.o)
"_SCNetworkReachabilityUnscheduleFromRunLoop", referenced from:
_kDefaultReachabilityApi in libGoogleAnalyticsServices.a(GAIReachabilityChecker.o)
"_deflate", referenced from:
+[GAICompressionUtil gai_dataByCompressingBytes:length:compressionLevel:mode:] in libGoogleAnalyticsServices.a(GAICompressionUtil.o)
"_deflateEnd", referenced from:
+[GAICompressionUtil gai_dataByCompressingBytes:length:compressionLevel:mode:] in libGoogleAnalyticsServices.a(GAICompressionUtil.o)
"_deflateInit2_", referenced from:
+[GAICompressionUtil gai_dataByCompressingBytes:length:compressionLevel:mode:] in libGoogleAnalyticsServices.a(GAICompressionUtil.o)
"_inflate", referenced from:
+[GAICompressionUtil gai_dataByInflatingBytes:length:isRawData:] in libGoogleAnalyticsServices.a(GAICompressionUtil.o)
"_inflateEnd", referenced from:
+[GAICompressionUtil gai_dataByInflatingBytes:length:isRawData:] in libGoogleAnalyticsServices.a(GAICompressionUtil.o)
"_inflateInit2_", referenced from:
+[GAICompressionUtil gai_dataByInflatingBytes:length:isRawData:] in libGoogleAnalyticsServices.a(GAICompressionUtil.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

我正在使用 Xcode 6 GM 并尝试编译在 iPhone 5s 模拟器中运行的应用程序。

编辑 1:

已经添加了所需的库

  • 核心数据框架
  • 系统配置.framework
  • libz.dylib

我已经部分解决了在桥接头文件中添加以下导入的错误

#import <CoreData/CoreData.h>
#import <SystemConfiguration/SystemConfiguration.h>

错误信息缩减为

Undefined symbols for architecture x86_64:
"_deflate", referenced from:
+[GAICompressionUtil gai_dataByCompressingBytes:length:compressionLevel:mode:] in libGoogleAnalyticsServices.a(GAICompressionUtil.o)
"_deflateEnd", referenced from:
+[GAICompressionUtil gai_dataByCompressingBytes:length:compressionLevel:mode:] in libGoogleAnalyticsServices.a(GAICompressionUtil.o)
"_deflateInit2_", referenced from:
+[GAICompressionUtil gai_dataByCompressingBytes:length:compressionLevel:mode:] in libGoogleAnalyticsServices.a(GAICompressionUtil.o)
"_inflate", referenced from:
+[GAICompressionUtil gai_dataByInflatingBytes:length:isRawData:] in libGoogleAnalyticsServices.a(GAICompressionUtil.o)
"_inflateEnd", referenced from:
+[GAICompressionUtil gai_dataByInflatingBytes:length:isRawData:] in libGoogleAnalyticsServices.a(GAICompressionUtil.o)
"_inflateInit2_", referenced from:
+[GAICompressionUtil gai_dataByInflatingBytes:length:isRawData:] in libGoogleAnalyticsServices.a(GAICompressionUtil.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

编辑 2:

最后我解决了这个问题。

Target Settings -> Build Settings -> Linking -> Other Linker Flags 添加以下标志:-lz

最佳答案

@Ezequiel Perez:您必须包含目标链接库。

CoreData.framework
SystemConfiguration.framework
libz.dylib

尝试包括这个....

关于swift - 使用 Swift 的 iOS 8 中的 Google Analytics 不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25873218/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com