Objective c firebase EXC\u错误\u访问日志事件名称

Objective c firebase EXC\u错误\u访问日志事件名称,objective-c,xcode,firebase,firebase-analytics,google-analytics-sdk,Objective C,Xcode,Firebase,Firebase Analytics,Google Analytics Sdk,使用FIRAnalytics logEventWithName:parameters方法时,EXC\u BAD\u访问导致应用程序崩溃。我这样称呼它: [FIRAnalytics logEventWithName:name parameters:paramethers]; 参数: name = "News_Detail" paramethers = { Title = "Lorem ipsum dolor is amet"; Category = "Lorem Ipsum C

使用FIRAnalytics logEventWithName:parameters方法时,EXC\u BAD\u访问导致应用程序崩溃。我这样称呼它:

[FIRAnalytics logEventWithName:name parameters:paramethers];
参数:

name = "News_Detail"

paramethers = {
    Title = "Lorem ipsum dolor is amet";
    Category = "Lorem Ipsum Category";
    URL = "https://api.loremipsum.com.uk/Contents/GalleryAlbum?appRef=iOSLoremIpsumApp&URL=%2floremipsum%2fdolor%2fisamet-loremipsum-loremipsum";
}
仅在此对象上崩溃

我正在使用cocoapods在我的项目中添加库,包括:

pod 'Google/Analytics' 

目前的版本是3.9.0。

这是因为参数值最多可以有100个字符长。我的对象的URL参数长度为132个字符

以下是FIRAnalytics.h下的方法摘要:

/// Logs an app event. The event can have up to 25 parameters. Events with the same name must have
/// the same parameters. Up to 500 event names are supported. Using predefined events and/or
/// parameters is recommended for optimal reporting.
///
/// The following event names are reserved and cannot be used:
/// <ul>
///     <li>app_clear_data</li>
///     <li>app_remove</li>
///     <li>app_update</li>
///     <li>error</li>
///     <li>first_open</li>
///     <li>in_app_purchase</li>
///     <li>notification_dismiss</li>
///     <li>notification_foreground</li>
///     <li>notification_open</li>
///     <li>notification_receive</li>
///     <li>os_update</li>
///     <li>session_start</li>
///     <li>user_engagement</li>
/// </ul>
///
/// @param name The name of the event. Should contain 1 to 40 alphanumeric characters or
///     underscores. The name must start with an alphabetic character. Some event names are
///     reserved. See FIREventNames.h for the list of reserved event names. The "firebase_" prefix
///     is reserved and should not be used. Note that event names are case-sensitive and that
///     logging two events whose names differ only in case will result in two distinct events.
/// @param parameters The dictionary of event parameters. Passing nil indicates that the event has
///     no parameters. Parameter names can be up to 40 characters long and must start with an
///     alphabetic character and contain only alphanumeric characters and underscores. Only NSString
///     and NSNumber (signed 64-bit integer and 64-bit floating-point number) parameter types are
///     supported. NSString parameter values can be up to 100 characters long. The "firebase_"
///     prefix is reserved and should not be used for parameter names.
我们可以这样称呼这个方法:

[FIRAnalytics logEventWithName:name parameters:paramethers != nil ? [self trimParameters:paramethers] : paramethers];
解决方案:

如@adbitx在评论中所说:“崩溃已在最新版本4.0.0中修复。”对于我来说,安装版本“4.0.0”pod update没有帮助

如果任何人想在今天使用“4.0.0”版本,需要使用:

或者等待其他pod库的更新


希望它能帮助别人。

这很糟糕。它将在不保存其余数据的情况下修剪字符串。取而代之的是,想出一种方法来命名变量,以表明存在多个部分,并将其拆分,否则数据将丢失。或者创建一个安全的假设,比如URL,只在末尾存储?查询部分,或者只存储参数本身。有很多方法可以压缩这些数据。NSString和NSURL还可以将字符串分解为主机、路径、参数。。。用那些来代替,你是对的。我认为这只适用于我的项目。因为我允许该参数的数据丢失。我会更新我的答案。谢谢。您使用的Firebase Analytics SDK版本是什么?我认为最新版本4.0.0已经修复了此崩溃。我尝试了相同的参数,但没有崩溃。但是,您的参数“URL”太长,因此不会被记录。
[FIRAnalytics logEventWithName:name parameters:paramethers != nil ? [self trimParameters:paramethers] : paramethers];
pod 'FirebaseAnalytics'