简体   繁体   中英

Delegate is not calling method

So i have a question . Can someone Tell me the Problem with this line of code for calling(protocol) a Method

 [self.delegate poplogin];

poplogin is method name , its not working for some reason. its not calling the method poplogin

for reference :

@property(nonatomic,retain) id<loginAuthDelegate> delegate;

So let me Explain the Case

so lets say i have a Class abc.h

@protocol loginAuthDelegate <NSObject>
-(void)poplogin;
@end

After interface

@property(nonatomic,retain) id<loginAuthDelegate> delegate;

in .m i am just calling the Delegate and @synthesize it
[self.delegate poplogin];

not i have another files
let say def.h
i am importing the Class abc.h
@interface def : UIViewController<loginAuthDelegate>



def.m
-(void)poplogin
{
NSLog(@"Delegate doesn't respond to here");
vmpaSecureLogin *ivc = [[vmpaSecureLogin alloc] init];
ivc.modalPresentationStyle = UIModalPresentationFormSheet;
[self presentModalViewController:ivc animated:YES];
}

This is probably because self.delegate is nil .

You probably forgot to affect your object's delegate to some other object in which you implemented the delegate methods, like your ViewController or something.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM