How do I convert my NSManagedObject to NSData object?
I'm new to Core Data and the Multipeer Connectivity Framework.
I need to transfer data between 2 devices via the Multipeer Connectivity Framework. I understand that I cannot simply transfer via MPC since it requires an NSData object.
Are there any third-party libraries that provides such function?
I think NSCoding is not such a good idea here. The reason is that the objects will not be the same on two different devices due to their internal managed object IDs as well as a myriad of other possible problems that can occur in unexpected syncing scenarios.
I would strongly recommend to take the trouble and convert your object into a NSDictionary type and then use the standard NSData APIs on the dictionary (or an array of dictionaries).
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