简体   繁体   English

iOS上的Google Analytics(分析)初始化崩溃

[英]Google Analytics initialisation crash on iOS

Been having a bit of an unusual crash when trying to set up Google Analytics in my app. 尝试在我的应用中设置Google Analytics(分析)时出现了异常崩溃。 The error itself isn't unknown (most iOS devs would be familiar with it), but seeing it come out of the initialisation of a widely-used third-party framework is. 该错误本身是未知的(大多数iOS开发人员会熟悉该错误),但看到它是由广泛使用的第三方框架的初始化产生的。

2016-06-09 11:15:19.549 <ProjName>[2937:204522] -[__NSCFNumber hasPrefix:]: unrecognized selector sent to instance 0xb000000000000003

This crash seems to be coming out of an attempt to initialise the GAI object, both accessing the shared instance object: 崩溃似乎是由于试图访问共享实例对象而初始化GAI对象而引起的:

let gai = GAI.sharedInstance()

or even manually initialising one (which is something I'd normally not do, but I'm running out of ideas) 甚至手动初始化一个(我通常不会这样做,但是我的想法已经用光了)

let gai = GAI()

Attempting to use the configuration file supplied by GA's setup guide and initialising it through the GGLContext object also creates an identical crash when calling configureWithError (presumably, this also initialises the GAI object the same way). 尝试使用GA的安装指南提供的配置文件并通过GGLContext对象对其进行初始化时,在调用configureWithError时也会造成相同的崩溃(大概这也以相同的方式初始化GAI对象)。

var configureError: NSError?
GGLContext.sharedInstance().configureWithError(&configureError)
assert(configureError == nil, "Error configuring Google services: \(configureError)")

I've tried this with both the cocoapods-installed version of GA, and manual installation of both the 3.15 and 3.13 versions of the SDK. 我已经使用cocoapods安装的GA版本以及手动安装SDK的3.15和3.13版本进行了尝试。 The project is written in Swift under Xcode 7.3, with a deployment target of iOS 8.0. 该项目是在Xcode 7.3下用Swift编写的,部署目标是iOS 8.0。

Has anyone else encountered an identical problem, or does anyone have any ideas as to why this is affecting this project specifically, or what else I could try? 是否还有其他人遇到过相同的问题,或者有人对为什么这会特别影响该项目有任何想法,或者我还能尝试什么?

I tried that and I don't see any error. 我试过了,没有看到任何错误。 Did you add the module import ? 是否添加了模块导入

I followed these steps https://developers.google.com/analytics/devguides/collection/ios/v3/#initialize-analytics-for-your-app 我按照以下步骤操作 https://developers.google.com/analytics/devguides/collection/ios/v3/#initialize-analytics-for-your-app

please be sure you are following this order: 请确保您遵循以下命令:

// Configure tracker from GoogleService-Info.plist.
var configureError:NSError?
GGLContext.sharedInstance().configureWithError(&configureError)
assert(configureError == nil, "Error configuring Google services: \(configureError)")

// Optional: configure GAI options.
let gai = GAI.sharedInstance()
gai.trackUncaughtExceptions = true  // report uncaught exceptions
gai.logger.logLevel = GAILogLevel.Verbose  // remove before app release

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM