我正在尝试将NSManagedObjectID附加到UILocalNotification但仍然收到错误: 属性列表格式无效:200(属性列表不能包含'CFType'类型的对象)在UILocalNotification中设置UserInfo时出错
这是我的代码(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]);
任务是一个NSManagedObject,该代码已经过测试并且工作正常了很长时间。
从我读过的一切都应该可行。任何帮助将不胜感激。
Jason
发布定义和实例化taskID的代码,机会就在于问题所在。 – Jim
在发布taskID的帖子中增加了一些信息。 – Jason