你能帮我吗?UILocalNotification崩溃
我设置了一个UILocalNotification,当我尝试设置它的userInfo字典时,它崩溃。 fetchedObjects包含88个对象。
下面是代码:
NSDictionary* myUserInfo = [NSDictionary dictionaryWithObject: fetchedObjects forKey: @"textbody"];
UILocalNotification *localNotif = [[UILocalNotification alloc] init];
if (localNotif == nil)
return;
// défining the interval
NSTimeInterval oneMinute = 60;
localNotif.timeZone = [NSTimeZone localTimeZone];
NSDate *fireDate = [[NSDate alloc]initWithTimeIntervalSinceNow:oneMinute];
localNotif.fireDate = fireDate;
localNotif.userInfo = myUserInfo; //this is the line that crashes the app
[fetchedObjects release];
和控制台给了我这样的:
Property list invalid for format: 200
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'unable to serialize userInfo: (null)'
任何想法?
实际上,我在fetchedObjects中有对象,我想要做的就是从名为textbody的键中检索一个值。但是我对如何做到这一点感到非常失望。我想要做的实际上是为包含在fetchedObjects中的每个对象创建一个包含textbody值(这是一个字符串)的UILocalNotification。 – 2011-01-09 11:18:37
我只是一个noob,并不知道如何做到这一点,虽然我绞尽脑汁对NSDictionaries的类参考。如果有人可以帮助,那将非常感激。 – 2011-01-09 11:27:08