How to use JSONKit to transmit data to a server in Xcode?

455 views Asked by At

I'm basically trying to send data to a server that contains objects and fellow peers have told me to use JSONKit.

As of now, I've implemented NSCoding protocol and serialized my objects with NSKeyedArchiver. But I can't find any resources on how to send out the data.

My code: import

JSONKit.h

Art* art = [[Art alloc] initWithArt:@"test"]; // Object that implemented NSCoding
NSError *err = nil;
NSData *data = [NSKeyedArchiver archivedDataWithRootObject:art];

This is where the confusion begins.

JSONDecoder *jsonDecoder = [[JSONDecoder alloc] init];
[jsonDecoder objectWithData:data error:&err];

I need to now send the data to the server with this:

[server sendData:finalData error:&err];

but I do not know how to get that finalData.

Any help is much appreciated, thanks in advance!

1

There are 1 answers

0
CodaFi On