2

I am trying to implement Keen.IO analytics for a Unity3d IOS Application. I went through the Keen.IO docs, integrated the library into the xcode project generated by Unity3D, and built successfully.

However when I try to make a simple straightforward "AddEvent" call from the AppController methods, I get this exception.

2014-05-22 18:04:20.591 Adding event to collection: testEvent1
2014-05-22 18:04:20.594 [__NSDictionaryM JSONDataWithOptions:serializeUnsupportedClassesUsingDelegate:selector:error:]: unrecognized selector sent to instance 0x34737e0
2014-05-22 18:04:20.596 Exception: -[__NSDictionaryM JSONDataWithOptions:serializeUnsupportedClassesUsingDelegate:selector:error:]: unrecognized selector sent to instance 0x34737e0

I am registering the KeenClient in the applicationDidBecomeActive() method (which works fine)and Calling AddEvent() in applicationDidEnterBackground() method with a simple NSDictionary:

NSDictionary *event = [NSDictionary dictionaryWithObjectsAndKeys:@"first view", @"view_name", @"going to", @"action", nil];
[[KeenClient sharedClient] addEvent:event toEventCollection:@"testEvent1" error:nil];

It looks like the Keen.IO Library code is raising this exception but I am suspecting if it is something to do with the Unity generated xcode project.

Any help from someone familiar is appreciated.

ofeida
  • 129
  • 1
  • 8

2 Answers2

1

Cross-posted from https://groups.google.com/forum/#!topic/keen-io-devs/hJ776FCa0DA.

It looks like you may be using an older version of the Keen IO iOS SDK that uses JSONKit for JSON serialization. The newest version uses Apple's NSJSONSerialization which shouldn't have this problem. Can you try downloading the latest universal binary / using the latest version from cocoapods?

Dan K.
  • 1,532
  • 10
  • 13
0

Another approach would be to integrate the .NET Keen Client, altho I've been trying and running into library compatibility issues. Specifically around System.Numerics. However, your Unity/Mono/.NET foo may be stronger than mine.

orion elenzil
  • 4,484
  • 3
  • 37
  • 49
  • 1
    you're right, it is. altho folks interested in this question might also be interested. I will convert my 'answer' into a 'it didn't work for me but try this' answer. – orion elenzil Aug 31 '15 at 19:51
  • While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. – Reeno Aug 31 '15 at 20:49
  • @reeno - I think the link doesn't contain the answer I'm suggesting; the link actually _is_ the answer I'm suggesting. If that link goes dead, there's nothing to integrate. all - I've looked at the keen client a bit more, and I think it might not be usable for Unity until Unity upgrades its .NET compatibility. However, an approach which looks much more feasible is to just directly use the Keen REST API. It doesn't look too bad at all. – orion elenzil Sep 01 '15 at 00:16