objective c - Archiving object to a read-only file -
i have app saving objects .sav files using nskeyedarchiver archiverootobject: tofile:
; however, realized if user open 1 of .sav files in textedit , change @ all, app fail unarchive objects next time opens, , stop working.
is there way can archive root objects read-only file or otherwise stop users editing them? they're buried in application support, not super accessible, i'd play safe.
i don't think there way avoid potentially losing saved state (in end user delete file), if worried user manipulating data, should look @ nssecurecoding.
i believe way avoid unarchiving "corrupt" data , guaranteeing integrity, have not explored topic further can't sure whether allow scenario in contents of specific fields changed (i.e object type same, value different).
in conclusion, think better/safer build system idea of trying circumvent security in mind , instead of trying stop user manipulating/deleting data, making sure invalid data not loaded in. example in case of invalid/corrupt/missing data reverting default values (i.e if app launching first time).
Comments
Post a Comment