Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/postgresql/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 如何将NSManagedObject传递给UILocalNotification的userInfo_Ios_Objective C_Core Data_Uilocalnotification_Nsnotification - Fatal编程技术网

Ios 如何将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传递给UILocalNotification的userInfo,类似于:

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,我知道根本原因,我想在这里询问解决方案。