Ios 如何将NSManagedObject传递给UILocalNotification的userInfo
我正在尝试将NSManagedObject传递给UILocalNotification的userInfo,类似于:Ios 如何将NSManagedObject传递给UILocalNotification的userInfo,ios,objective-c,core-data,uilocalnotification,nsnotification,Ios,Objective C,Core Data,Uilocalnotification,Nsnotification,我正在尝试将NSManagedObject传递给UILocalNotification的userInfo,类似于: NSManagedObject *obj = ...; UILocalNotification* localNotification = [[[UILocalNotification alloc] init] autorelease]; localNotification.userInfo = [NSDictionary dictionaryWithObjectsAndKeys:
NSManagedObject *obj = ...;
UILocalNotification* localNotification = [[[UILocalNotification alloc] init] autorelease];
localNotification.userInfo = [NSDictionary dictionaryWithObjectsAndKeys:obj, @"KeyName", nil];
但由于以下错误,它崩溃了
属性列表的格式无效:200(属性列表不能包含“CFType”类型的对象)
***由于未捕获的异常“NSInvalidArgumentException”而终止应用程序,原因:“无法序列化userInfo:(null)”
据我所知,根本原因是NSManagedObject不可序列化,因此如何解决此问题?这里有什么解决办法吗
我也尝试过NSManagedObjectID,但在这里也遇到了同样的错误。试试这个Matt Gallagher的博客文章:
然后尝试:请在此处显示。。。。。。谢谢@Rohitsuvagiya,我知道根本原因,我想在这里询问解决方案。