Archiving / Unarchiving results in initForReadingWithData incomprehensible archive

后端 未结 3 1593
無奈伤痛
無奈伤痛 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

    For the bool and int, there are two methods: encodeBool:forKey: and encodeInt:forKey: (taken from the NSKeyedArchiver reference).

    For the NSMutableData, you should archive them with encodeObjectForKey: and unarchive them with decodeObjectForKey:.

    You can refer to this useful guide for more cases.

提交回复
热议问题