我正在嘗試將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