【问题标题】:How to pass NSManagedObject to userInfo of UILocalNotification如何将 NSManagedObject 传递给 UILocalNotification 的 userInfo
【发布时间】:2015-07-08 10:50:16
【问题描述】:

我正在尝试将 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,在这里也遇到了同样的错误。

【问题讨论】:

标签: ios objective-c core-data uilocalnotification nsnotification


【解决方案1】:

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多