0

I'm trying to pass an NSManagedObject to userInfo of UILocalNotification, something like:

NSManagedObject *obj = ...;

UILocalNotification* localNotification = [[[UILocalNotification alloc] init] autorelease];
localNotification.userInfo = [NSDictionary dictionaryWithObjectsAndKeys:obj, @"KeyName", nil];

but it crashed with below error

Property list invalid for format: 200 (property lists cannot contain objects of type 'CFType') *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'unable to serialize userInfo: (null)'

To my understanding, the root cause is that NSManagedObject is not serializable, so how to fix this issue? any workaround here?

I have also tried NSManagedObjectID, and got same error here.

Yuwen Yan
  • 4,349
  • 9
  • 32
  • 59

1 Answers1

0

try this Matt Gallagher has a great blog post about this: http://cocoawithlove.com/2008/08/safely-fetching-nsmanagedobject-by-uri.html

and try : Error when setting UserInfo in UILocalNotification

Community
  • 1
  • 1
Jay Bhalani
  • 4,234
  • 8
  • 36
  • 48