ios - NSKeyedArchiver thread safe? -


do need worry using archiverootobject , unarchiveobjectwithfile in background threads?

dispatch_async(dispatch_get_global_queue(dispatch_queue_priority_default, 0), ^{     [nskeyedarchiver archiverootobject:myarray tofile:file]; }); 

you should careful that. archiverootobject not atomic operation. instance, if call archiverootobject on background thread while thread changes state of object being archived, end archiving illegal state of object. of course heavily depends on application , how implemented archive/unarchive routines objects.

however, if can make sure object doesn't change state while archiving background thread in progress, should safe so.


Comments