도와 주시겠습니까?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을 만드는 것입니다. –
나는 멍청한 놈일 뿐이지 만 NSDictionaries의 수업 참조에 두뇌를 기울이고 있지만 어떻게하는지 알아낼 수 없다. 누군가가 도울 수 있다면, 그것은 크게 감사 할 것입니다. –
[fetchedObjects valueForKeyPath : @ "textbody"]을 시도하면 객체의 모든 textbody 속성을 포함하는 NSArray를 얻을 수 있습니다. – Jilouc