Storing custom objects in an NSMutableArray in NSUserDefaults

后端 未结 5 1620
情深已故
情深已故 2020-11-22 16:11

I\'ve recently been trying to store the search results of my iPhone app in the NSUserDefaults collection. I also use this to save user registration info successfully, but fo

5条回答
  •  忘了有多久
    2020-11-22 16:28

    See "Why NSUserDefaults failed to save NSMutableDictionary in iPhone SDK? " (Why NSUserDefaults failed to save NSMutableDictionary in iPhone SDK?)


    If you want to (de)serialize custom objects, you have to provide the functions to (de)serialize the data (NSCoding protocol). The solution you refer to works with the int array because the array is not an object but a contiguous chunk of memory.

提交回复
热议问题