I have an application where I would like to exchange information, managed via Core Data, between two iPhones.
Has anyone attempted this and if so what is deemed to be the best approach to doing so (i.e. are people using some intermediate format such as XML or JSON in a file or can the objects be transfered directly).
My apologies if the question appears too boroad in scope but I'm at the stage where I need to decide on an approach for the transfer and I Have no experience of this API.
I would be extremely grateful for any code samples, or links to any such sample, for transferring objects between devices using GameKit.
You can't transfer Core Data objects directly between devices because they are linked to their context and persistent stores. You would need to translate the data into an intermediary format (can be as simple as a NSDictionary that gets turned into NSData) and push that across the connection and then reconstitute the data on the other side.
Personally I feel that JSON is great for this type of situation because you can easily turn the Core Data object graph into a set of JSON consumable objects (dictionaries, arrays, strings and numbers) which can easily be moved around.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With