How do I convert an NSNumber to NSData?
I need to transmit an integer through GameKit using sendDataToAllPeers:withDataMode:error: but I don't know how to convert my NSNumber to NSData in order to send. I currently have: NSNumber *indexNum = [NSNumber numberWithInt:index]; [gkSession sendDataToAllPeers:indexNum withDataMode:GKSendDataReliable error:nil]; but obviously the indexNum needs to be converted to NSData before I can send it. Does anyone know how to do this please? Thanks! I would not recommend NSKeyedArchiver for such a simple task, because it adds PLIST overhead on top of it and class versioning. Pack: NSUInteger index =