Cordova-plugin-firebasex: logEvent iOS Error

Created on 21 Sep 2019  路  6Comments  路  Source: dpa99c/cordova-plugin-firebasex

Cordova CLI: 9.0.0
Cordova iOS platform: 5.0.1
Cordova-plugin-firebasex: 6.1.0
Firebase SDK: 6.3.0
Xcode: 11 GM Seed 2

Whenever I call logEvent() and pass a JSON object to the 2nd parameter, the Xcode console returns the following types of errors:
[__NSDictionaryM length]: unrecognized selector sent to instance 0x123456789

My JSON objects are valid, i.e.
{"page" : "1", "id" : "12345" }

The Firebase Event dashboard correctly detects these reported event parameters and values, and the app seems to function fine, just that the console error is always returned and I'm not sure if it will eventually cause a crash.

This error occurs on both iOS 12 and 13 devices. Thank you.

bug ios legacy runtime issue

Most helpful comment

The unrecognized selector sent to instance log warning message is caused by unnecessary code (inherited from cordova-plugin-firebase) which is removed by the above commit and will be pushed out with the next release.

All 6 comments

Hi @Akz47
Do you get the params value in the firebase dashboard?
I'm currently can not get any params value in the FB dashboard on iOS. Android works normally.

Did you set up the parameters as Text or Number format in Firebase? I found that only Text parameters are successfully reported / received.

Did you set up the parameters as Text or Number format in Firebase?

Did you mean the option "Edit parameter reporting"?
I set up the param as Text for some events but it also doesn't work. FB dashboard appears only the event name.

How are you passing in the params & values at Cordova Javascript's logEvent?

It needs to be passed in as JSON objects, i.e. {"page" : "1", "id" : "12345" }. If you pass in just a string / value, it'll be wrongly reported to the "NSLocalizedDescription" parameter in Firebase.

The thing is, if you correctly pass in a JSON object, then Xcode throws the "__NSDictionaryM length" error, thus my original issue raised.

Hi all, @dpa99c

I use test-master project. It will log "my_event" when app ready. But in the debug view, I can't get the param "foo"
```// Analytics
function logEvent(){
FirebasePlugin.logEvent("my_event", {"foo": "bar"}, function(){
log("Logged event");
},function(error){
log("Failed to log event: " + error);
});
}

Evironment: Cordova 9.0, cordova-ios: 5.0.1
This is XCode log
```2019-10-16 16:29:17.264030+0700 FirebaseTest[34023:8362619] 6.3.0 - [Firebase/Analytics][I-ACS031006] View controller already tracked. Class, ID: MainViewController, -8133574361838525130
2019-10-16 16:29:17.279503+0700 FirebaseTest[34023:8362656] 6.3.0 - [Firebase/Analytics][I-ACS035001] Cannot create Value type with unsupported value. The Value has to be NSNumber or NSString. Value: {
    foo = bar;
}
2019-10-16 16:29:17.279597+0700 FirebaseTest[34023:8362656] 6.3.0 - [Firebase/Analytics][I-ACS016000] Event parameter value must be of type NSString or NSNumber. Type: __NSDictionaryM
2019-10-16 16:29:17.282540+0700 FirebaseTest[34023:8362619] 6.3.0 - [Firebase/Analytics][I-ACS023051] Logging event: origin, name, params: app, my_event, {
    firebase_event_origin (_o) = app;
    firebase_screen (_sn) = my_screen;
    firebase_screen_class (_sc) = MainViewController;
    ga_screen_id (_si) = -8133574361838525130;
}
2019-10-16 16:29:17.284355+0700 FirebaseTest[34023:8362619] 6.3.0 - [Firebase/Analytics][I-ACS023073] Debug mode is enabled. Marking event as debug and real-time. Event name, parameters: my_event, {
    firebase_debug (_dbg) = 1;
    firebase_event_origin (_o) = app;
    firebase_screen (_sn) = my_screen;
    firebase_screen_class (_sc) = MainViewController;
    ga_realtime (_r) = 1;
    ga_screen_id (_si) = -8133574361838525130;
}
2019-10-16 16:29:17.287660+0700 FirebaseTest[34023:8362512] Logged event
2019-10-16 16:29:17.312773+0700 FirebaseTest[34023:8362657] 6.3.0 - [Firebase/Analytics][I-ACS023072] Event logged. Event name, event params: my_event, {
    firebase_debug (_dbg) = 1;
    firebase_event_origin (_o) = app;
    firebase_screen (_sn) = my_screen;
    firebase_screen_class (_sc) = MainViewController;
    ga_realtime (_r) = 1;
    ga_screen_id (_si) = -8133574361838525130;
}
2019-10-16 16:29:17.321739+0700 FirebaseTest[34023:8362649] 6.3.0 - [Firebase/Analytics][I-ACS002002] Measurement timer scheduled to fire in approx. (s): 0.9524577856063843
2019-10-16 16:29:17.322388+0700 FirebaseTest[34023:8362649] 6.3.0 - [Firebase/Analytics][I-ACS023028] Upload task scheduled to be executed in approx. (s): 0.9524577856063843
2019-10-16 16:29:18.431874+0700 FirebaseTest[34023:8362656] 6.3.0 - [Firebase/Performance][I-PRF100010] Clearcut is about to send logs. 1 upload blocks will be ran.
2019-10-16 16:29:18.432879+0700 FirebaseTest[34023:8362656] 6.3.0 - [Firebase/Analytics][I-ACS002001] Measurement timer fired
2019-10-16 16:29:18.433623+0700 FirebaseTest[34023:8362656] 6.3.0 - [Firebase/Analytics][I-ACS002003] Measurement timer canceled
2019-10-16 16:29:18.436908+0700 FirebaseTest[34023:8362656] 6.3.0 - [Firebase/Analytics][I-ACS023033] Starting data upload
2019-10-16 16:29:18.448352+0700 FirebaseTest[34023:8362656] 6.3.0 - [Firebase/Analytics][I-ACS023105] Event is not subject to real-time event count daily limit. Marking an event as real-time. Event name, parameters: my_event, {
    firebase_debug (_dbg) = 1;
    firebase_event_origin (_o) = app;
    firebase_screen (_sn) = my_screen;
    firebase_screen_class (_sc) = MainViewController;
    ga_realtime (_r) = 1;
    ga_screen_id (_si) = -8133574361838525130;
}
2019-10-16 16:29:18.455384+0700 FirebaseTest[34023:8362656] 6.3.0 - [Firebase/Analytics][I-ACS012018] Saving bundle. size (bytes): 539
2019-10-16 16:29:18.456505+0700 FirebaseTest[34023:8362656] 6.3.0 - [Firebase/Analytics][I-ACS023116] Bundle added to the upload queue. BundleID, timestamp (ms): 970, 1571218157273
2019-10-16 16:29:18.469961+0700 FirebaseTest[34023:8362656] 6.3.0 - [Firebase/Analytics][I-ACS023038] Uploading events. Elapsed time since last successful upload (s): 43.28506207466125
2019-10-16 16:29:18.470077+0700 FirebaseTest[34023:8362656] 6.3.0 - [Firebase/Analytics][I-ACS023039] Measurement data sent to network. Timestamp (ms), data: 1571218158466, <APMPBMeasurementBatch: 0x174007870>
2019-10-16 16:29:18.476430+0700 FirebaseTest[34023:8362649] 6.3.0 - [Firebase/Analytics][I-ACS900000] Uploading data. Host: https://app-measurement.com/a
2019-10-16 16:29:18.567792+0700 FirebaseTest[34023:8362656] 6.3.0 - [Firebase/Analytics][I-ACS901006] Received SSL challenge for host. Host: https://app-measurement.com/a
2019-10-16 16:29:18.691408+0700 FirebaseTest[34023:8362649] 6.3.0 - [Firebase/Performance][I-PRF100009] Recording network trace: https://app-measurement.com/a
2019-10-16 16:29:18.696457+0700 FirebaseTest[34023:8362657] 6.3.0 - [Firebase/Analytics][I-ACS023044] Successful upload. Got network response. Code, size: 204, -1
2019-10-16 16:29:18.701840+0700 FirebaseTest[34023:8362657] 6.3.0 - [Firebase/Analytics][I-ACS002002] Measurement timer scheduled to fire in approx. (s): -0.4275569915771484
2019-10-16 16:29:18.703600+0700 FirebaseTest[34023:8362657] 6.3.0 - [Firebase/Analytics][I-ACS023028] Upload task scheduled to be executed in approx. (s): -0.4275569915771484
2019-10-16 16:29:18.718685+0700 FirebaseTest[34023:8362657] 6.3.0 - [Firebase/Analytics][I-ACS023024] No data to upload. Upload task will not be scheduled
2019-10-16 16:29:18.719628+0700 FirebaseTest[34023:8362657] 6.3.0 - [Firebase/Analytics][I-ACS002003] Measurement timer canceled
2019-10-16 16:29:33.949884+0700 FirebaseTest[34023:8362691] 6.3.0 - [Firebase/Messaging][I-FCM005017] RMQ: Sending GtalkHeartbeatPing with outgoing stream Id: 4.
2019-10-16 16:29:33.951206+0700 FirebaseTest[34023:8362691] 6.3.0 - [Firebase/Messaging][I-FCM005023] Send msg: (null) type: 0 inStreamId: 4 outStreamId: 4
2019-10-16 16:29:34.057225+0700 FirebaseTest[34023:8362691] 6.3.0 - [Firebase/Messaging][I-FCM005015] RMQ: Receiving GtalkHeartbeatAck with incoming stream Id: 5.
2019-10-16 16:29:34.057347+0700 FirebaseTest[34023:8362691] 6.3.0 - [Firebase/Messaging][I-FCM005019] RMQ: Server last received stream Id: 4.
2019-10-16 16:30:04.056920+0700 FirebaseTest[34023:8362730] 6.3.0 - [Firebase/Messaging][I-FCM005017] RMQ: Sending GtalkHeartbeatPing with outgoing stream Id: 5.
2019-10-16 16:30:04.057047+0700 FirebaseTest[34023:8362730] 6.3.0 - [Firebase/Messaging][I-FCM005023] Send msg: (null) type: 0 inStreamId: 5 outStreamId: 5
2019-10-16 16:30:04.367011+0700 FirebaseTest[34023:8362730] 6.3.0 - [Firebase/Messaging][I-FCM005015] RMQ: Receiving GtalkHeartbeatAck with incoming stream Id: 6.
2019-10-16 16:30:04.368175+0700 FirebaseTest[34023:8362730] 6.3.0 - [Firebase/Messaging][I-FCM005019] RMQ: Server last received stream Id: 5.
2019-10-16 16:30:34.367825+0700 FirebaseTest[34023:8362731] 6.3.0 - [Firebase/Messaging][I-FCM005017] RMQ: Sending GtalkHeartbeatPing with outgoing stream Id: 6.
2019-10-16 16:30:34.368755+0700 FirebaseTest[34023:8362731] 6.3.0 - [Firebase/Messaging][I-FCM005023] Send msg: (null) type: 0 inStreamId: 6 outStreamId: 6
2019-10-16 16:30:34.437129+0700 FirebaseTest[34023:8362731] 6.3.0 - [Firebase/Messaging][I-FCM005015] RMQ: Receiving GtalkHeartbeatAck with incoming stream Id: 7.
2019-10-16 16:30:34.437965+0700 FirebaseTest[34023:8362731] 6.3.0 - [Firebase/Messaging][I-FCM005019] RMQ: Server last received stream Id: 6.

Annotation 2019-10-16 160623


If log event with a string, then the event will be logged with param NSLocalizedDescription, value = {"foo": "bar"}.
No any error log in XCode.
FirebasePlugin.logEvent("my_event", '{"foo": "bar"}', ...


I fixed this issue by adjusting the native code:
FirebasePlugin.m => function logEvent
=> NSDictionary *parameters = [command argumentAtIndex:1];

The unrecognized selector sent to instance log warning message is caused by unnecessary code (inherited from cordova-plugin-firebase) which is removed by the above commit and will be pushed out with the next release.

Was this page helpful?
1 / 5 - 1 ratings

Related issues

marcelonnunes picture marcelonnunes  路  3Comments

JumBay picture JumBay  路  7Comments

almothafar picture almothafar  路  5Comments

DavidStrausz picture DavidStrausz  路  3Comments

deveshmishra34 picture deveshmishra34  路  7Comments