Storing data to NSUserDefaults

后端 未结 4 1164
伪装坚强ぢ
伪装坚强ぢ 2020-11-30 09:01

In my iPhone app, I have a class called Contact which consists of an ABRecordRef to serve as a reference to a particular contact.

I need to

4条回答
  •  广开言路
    2020-11-30 10:04

    Well, Apple's recommendation is to store the record identifier, the first name, and the last name. You can then try retrieving the contact from the address book by the identifier and, if the record isn't found or if it's not the right person, try retrieving by first and last name (since record identifiers may change depending on the source of your address book data).

    This may or may not be what you want, depending on why you're storing the data. But, you could pretty easily put those three values into an NSDictionary and write the dictionary to NSUserDefaults.

提交回复
热议问题