iPhone: serialize and send objects over bluetooth?

2020-05-01 09:26发布

问题:

What is the best way to serialize an object and send it over a bluetooth (or network connection)?

回答1:

you can use the gamekit APIs.

sendDataToAllPeers:withDataMode:error: or

sendData:toPeers:withDataMode:error:

the data can be any format encapsulated in NSData.