Archiving / Unarchiving results in initForReadingWithData incomprehensible archive

后端 未结 3 1594
無奈伤痛
無奈伤痛 2021-01-03 08:08

I\'ve implemented an save on applicationWillTerminate and load on applicationWillFinishLoading. There is a complete object tree, all implement the

3条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-01-03 08:21

    FWIW I have also come across this problem and here is what I've found.

    The bytes reported 0x62, 0x70, 0x6c, etc., are part of the magic string "bplist" at the start of a binary property list, which NSKeyedArchiver uses by default.

    A binary property list stores metadata in a trailer (i.e. at the end of the data). So if it gets truncated, the entire plist becomes unreadable.

    If you want to check whether that's what has happened to you, you can use NSPropertyListReader_binary1 from Cocotron (http://code.google.com/p/cocotron/source/browse/Foundation/NSPropertyList/) to see how the file format works.

    Hope this helps someone!

提交回复
热议问题