私はローカル通知に取り組んでおり、各通知を識別するために、Core Data モデルからその辞書のキーとしてNSDictionary
を取得する必要があります。ManagedObjectID
問題は、これを行うと次のエラーが発生することです。
Property list invalid for format: 200 (property list dictionaries may only have keys which are CFStrings, not 'CFType')
これは、辞書が特定のデータ型のみを格納でき、NSManagedObjectID を格納できないという事実に関係しています。
私の質問は、これNSManagedObjectId
をNSString
orに変換する方法はありますかNSNumber
。その特定の通知を削除するために後で識別するために、その特定のIDが本当に必要です。
これまでのコード:
-(void) scheduleNotificationAtDate:(NSDate*)date WithBody:(NSString*) body WithBillEventId:(NSManagedObjectID*) billEventId{
// Schedule the notification
UILocalNotification* localNotification = [[UILocalNotification alloc] init];
localNotification.fireDate = date;
localNotification.alertBody = body;
localNotification.alertAction = @"Ga naar de Rekening Delen app";
localNotification.timeZone = [NSTimeZone defaultTimeZone];
localNotification.applicationIconBadgeNumber = [[UIApplication sharedApplication] applicationIconBadgeNumber] + 1;
//set the dictionary here,
NSDictionary *billEventIdentifier = [NSDictionary dictionaryWithObject:@"billevent_notification" forKey: billEventId];
localNotification.userInfo = billEventIdentifier;
NSLog(@"set local notification");
[[UIApplication sharedApplication] scheduleLocalNotification:localNotification];
}