Reputation: 1824
I have a problem with sending string via game center.
I am able to send everything but can't send a NSString
or NSArray
.
I have searched and found a lot of information through the google, but haven't found any examples which help me.
Can anyone tell me how to send and receive a NSString
with game center?
Thanks. George.
Upvotes: 1
Views: 405
Reputation: 14851
NSString *yourString;
NSData *stringData = [yourString dataUsingEncoding:NSUTF8StringEncoding];
and send it like this, for decompression on the receivers side:
recievedString = [[NSString stringWithUTF8String:[recievedData bytes]] retain];
Upvotes: 2