【发布时间】:2011-10-27 17:23:35
【问题描述】:
我正在尝试将 NSManagedObjectID 附加到 UILocalNotification 但不断收到错误消息: 属性列表格式无效:200(属性列表不能包含“CFType”类型的对象)
这是我的代码(taskID 是一个 NSManagedObjectID):
// Create the new notification
UILocalNotification *newNotice = [[notificationClass alloc] init];
[newNotice setFireDate:date];
[newNotice setTimeZone:[NSTimeZone defaultTimeZone]];
[newNotice setAlertBody:@"Test text"];
// Add the object ID to the userinfo
NSDictionary *myUserInfo = [NSDictionary dictionaryWithObject:taskID forKey:@"TaskID"];
newNotice.userInfo = myUserInfo;
taskID 使用此代码(第一个参数)传递给函数:
addNotification([task objectID], [task taskname], [task taskexpiry]);
task 是一个 NSManagedObject 并且该代码已经过测试并且可以正常运行很长时间。
从我读过的所有内容来看,这应该可以。任何帮助将不胜感激。
杰森
【问题讨论】:
-
发布定义和实例化
taskID的代码,很可能这就是问题所在。 -
在帖子中添加了更多关于 taskID 来自何处的信息。
标签: objective-c uilocalnotification userinfo