ioscocoa-touchuilocalnotificationproperty-list

Store custom objects in UILocalNotification's userInfo without encoding


I have a custom class called Person that I want to store in UILocalNotification's userInfo (NSDictionary).

Is there any way to save it without converting it to NSData object using -encodeWithCoder:?


Solution

  • One simple workaround is to give every person a unique id and store the id in userInfo. Save an instance of person and fetch it with the id whenever you need to get the userInfo