I'm working with a remote library that is delivering this object to me.
If I set my debugger, I get this information :
KandyChatMessage: UUID - 70886A79-2FF60F5E1A3961EF , timestamp - 2017-02-13 17:46:12 +0000 , sender - uri - 3@domain.domain.com, userName - 3, domain - domain.domain.com, type - 0, associationType - 1 , recipient - uri - afdab3bfb5774@domain.domain.com, userName - afdab3bfb57a12b5, domain - domain.domain.com, type - 1, associationType - 1 , type: - 1 , mediaItem - KandyTextMessageData - text:3 , info:(null) , isIncoming - 1 , additionalData - (null), fromHistory - NO
It is delivered via this method :
-(void)_addEventAndRefresh:(id<KandyEventProtocol>)event{
The goal is to convert this object into JSON with something like this :
NSError *error;
NSData *jsonData = [NSJSONSerialization dataWithJSONObject:event
options:0
error:&error];
However, this crashes my app as I assume that event
doesn't fulfill all the rules of a serializable NSMUtableArray
or a NSDictionary
for some reason.
This leaves me with two options. One, I can find some crafty method to convert whatever object this is into JSON. Or two, I can cherry-pick its data out and write an NSDictionary Object from scratch.
Would anyone have the slightest clue on how to pick this kind of object apart?
In my debugger
, it doesn't seem to respond to anything..
> po event.UUID
=> error: property 'UUID' not found on object of type 'id'
> po event.timestamp
=> error: property 'timestamp' not found on object of type 'id'