iphone - NSNotification center may not respond to -object? -
I am trying to make an easy use of the NS Annotation Center within my iPhone application, but I think there is something in it This case is wrong. I was under the impression that it is possible to retrieve an object with a special message, or at least one reference to the object, but I get a warning using the following example code,
< P> "NSNotification center-object can not be answered" - (zero) addNewBookmark: (NSNotificationCenter *) Notification {Bookmark * newBookMark = (Bookmark *) [Notification Object]; // Some items with the bookmark object}
In fact, when I compile and run the code, basically nothing that I try to do with the contents of the object is actually
- (IBAction) save: sending message with sender {// related object [[NSNetification Centers Defender Center] PostNotificationName: @ "addNewBookmark" object: bookmark]; }
And the bookmark object is a dictionary, I tried to use the "user input" logic and passed the bookmark object in it, but the result was the same.
How should I do this? What am i doing wrong
Your addNewBookmark:
method must accept an NSNotification not NSNotificationCenter.
NSNetification should respond as expected to -object
.
A notification center, who is listening, is accused of keeping track of and sending them notifications (not the center).
Comments
Post a Comment