I am working on local notifications and in order to identify each notification it needs to get a NSDictionary
with the ManagedObjectID
from the Core Data model as key of that dictionary.
The problem is thatwhen I do this I get the following error:
Property list invalid for format: 200 (property list dictionaries may only have keys which are CFStrings, not 'CFType')
which has to do with the fact that dictionaries can only store certain data types and not NSManagedObjectID.
So my question is, is there a way to convert this NSManagedObjectId
to a NSString
or NSNumber
for example. I really need that specific id in order to identify it later on to remove that specific notification.
Code thus far:
-(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];
}