ios - Delegate Method failing to call when tested with If statement, but calls correctly without If statement -
i have if statement checking if delegate has implemented given method:
if ([[self delegate] respondstoselector:@selector(didfinishsettingnotificationondialog:)]) { [self.delegate didfinishsettingnotificationondialog:self withnotification:notification]; }
however code not getting executed within if statement. have other delegate calls working between these objects and if remove if statement , call
[self.delegate didfinishsettingnotificationondialog:self withnotification:notification];
on own works!
my delegate implement correctly:
- (void)didfinishsettingnotificationondialog:(notificationdialogview *)dialogview withnotification:(notificationcontext *)setnotification{ nslog(@"notification is: %@", setnotification); }
so doing wrong?
the name of method wrong. should didfinishsettingnotificationondialog:withnotification:
.
try this:
if ([[self delegate] respondstoselector:@selector(didfinishsettingnotificationondialog:withnotification:)]) { [self.delegate didfinishsettingnotificationondialog:self withnotification:notification]; }
Comments
Post a Comment