What type of data should I use to store GUIDs in Core Data?

I'm going to generate CFUUID objects (if there is a better way to create a GUID in iOS, let me know) that need to be saved using Core Data. Core Data does not have a GUID data type. What is the preferred type? It looks like CFUUID objects are easily converted to and from a string, which is why I think so. Another option might be binary information.

Another consideration is that these GUIDs will come in and out of JSON objects (using the built-in JSON serialization for JSON through NSJSONSerialization).
+6
source share
1 answer

If I did this, I would just save it as a string.

You can save it as binary data, but since it is going to enter and output from the string (which is JSON), it may be easier to store it as a string and not worry about converting it back and forth.

+8
source

Source: https://habr.com/ru/post/914337/


All Articles