내 iPhone 응용 프로그램 내에서 NSNotification 센터를 간단하게 사용하려고하지만이 경우에는 잘못된 것 같습니다. 나는 특정 메시지와 관련된 객체 또는 객체에 대한 참조를 검색 할 수 있다는 인상을 받았지만 다음 예제 코드를 사용하여 경고 메시지가 표시됩니다.NSNotification 센터가 -object에 응답하지 않을 수 있습니까?
"NSNotification center는 나는 실제로 수행됩니다 개체의 내용을 수행하려고 기본적으로 아무것도 내가 컴파일 할 때, 실제로 "
- (void)addNewBookmark:(NSNotificationCenter *)notification {
Bookmark *newBookMark = (Bookmark *)[notification object];
//Do some stuff with the bookmark object
}
을 -object에 응답하지 않고 코드를 실행 - 단순히 무시됩니다.
다음과 같이 우편 번호가,
- (IBAction)save:(id) sender{
//Sending the message with the related object
[[NSNotificationCenter defaultCenter]
postNotificationName:@"addNewBookmark"
object:bookmark];
}
및 책갈피 개체 자체는 사전입니다. 또한 "userInfo"인수를 사용하여 북마크 객체를 전달하려고 시도했지만 결과는 동일합니다.
어떻게해야합니까? 내가 도대체 뭘 잘못하고있는 겁니까?
오, 이런, 어리석은 기분. 자동 완성 기능이 너무 빠릅니다. 타이머가 허용하자마자이를 허용하십시오. – si28719e