Уведомление не распознано - PullRequest
0 голосов
/ 08 апреля 2010

Я пытаюсь опубликовать уведомление без особого успеха! я могу сделать это хорошо для клавиатуры без проблем, но сейчас я пытаюсь настроить как следующим образом:

В моем rootview у меня есть

.h

-(void) allowEdits:(NSNotification *)notification;

.m

//this section is run in method to present the passcode entry form


[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(allowEdits:) name: @"PasscodeOK" object:nil];

PasscodeEntryViewController *vc = [[PasscodeEntryViewController alloc]
init];

[self presentModalViewController: vc animated:YES];

[vc release];


// and this is the response to the notification

-(void) allowEdits:(NSNotification *)notification {

    NSLog(@"notification fired");
}


// in the vc instance I have this to notify passcode was ok

[[NSNotificationCenter defaultCenter]
postNotificationName:@"PasscodeOK" object:nil];

[self dismissView];

Но allowEdits никогда не вызывается?

1 Ответ

0 голосов
/ 08 апреля 2010

Не могли бы вы опубликовать свое уведомление с:

[[NSNotificationCenter defaultCenter] postNotificationName:@"PasscodeOK" object:self];

В качестве отправителя возьмите экземпляр vc (self) вместо nil. Может быть, это решает вашу проблему.

...