I am developing multiplayer game using game centre, Overall Code is working well if my both device is 64bit or 32bit, but if my one device is 32bit and other is 64bit than sending data is not correct, please help me,
thanks in Advance
- (void)sendDataToPlayers:(void *)data length:(NSInteger)length
{ NSError *error = nil;
NSLog(@"lenth %i",(int)data);
NSData *package = [NSData dataWithBytes:data length:length];
[self.currentMatch sendDataToAllPlayers:package withDataMode:GKMatchSendDataReliable error:&error];
[self setLastError:error];
} - (void)match:(GKMatch *)match didReceiveData:(NSData *)data fromPlayer:(NSString *)playerID {
[self.transportDataDelegate onReceivedData:data fromPlayer:playerID];
}
You could for example look at NSJSONSerialization, which allows you to convert any dictionary or array containing dictionaries, arrays, numbers, strings, and NSNull values to NSData in a 100% portable way. There is one method turning dictionary or array into NSData, and another to turn NSData back into the exact same dictionary or array.