Objective c Simperium,获取AuthManager的代理通知
好吧,我完全被卡住了,我想知道是否有人能指出我犯的明显错误 我正在一个项目中使用Simperium(开发分支),如果用户取消身份验证窗口,我希望在主AppDelegate中获得通知 现在,SPAutheticationManager.m文件中有以下代码:Objective c Simperium,获取AuthManager的代理通知,objective-c,xcode,cocoa,simperium,Objective C,Xcode,Cocoa,Simperium,好吧,我完全被卡住了,我想知道是否有人能指出我犯的明显错误 我正在一个项目中使用Simperium(开发分支),如果用户取消身份验证窗口,我希望在主AppDelegate中获得通知 现在,SPAutheticationManager.m文件中有以下代码: - (void)cancel { DDLogVerbose(@"Simperium authentication cancelled"); if ([delegate respondsToSelector:@selector(
- (void)cancel {
DDLogVerbose(@"Simperium authentication cancelled");
if ([delegate respondsToSelector:@selector(authenticationDidCancel)])
[delegate authenticationDidCancel];
}
我已经设置了一个断点,当窗口关闭时肯定会调用它
现在,我已经在我的AppDelegate中将SpaAuthenticationDelegate添加到我的实现中,然后将以下代码添加到AppDelegate.m
-(void)authenticationDidCancel {
NSLog(@"Authetication Cancelled");
}
但是,没有人打电话给我,我不知道为什么
有人知道我错过了什么吗
谢谢
Gareth如果其他人遇到此问题,如果不在simperium.h中实现自定义委托方法并使您的AppDelegate.h成为它的委托,则无法完成此操作 在simperium.h
- (void)didCancelAuth;
然后在simperium.m authenticationDidCancel方法中添加:
if ([delegate respondsToSelector:@selector(didCancelAuth)]) {
[delegate didCancelAuth];
}
然后将appDelegate设置为simperium的委托并添加:
- (void)didCancelAuth
{
//auth has been cancelled
}
您还需要通过执行以下操作来确保您的appdelegate是一个委托
self.simperium.delegate = self;
干杯
Gareth只是想让您知道,我们刚刚添加了一个全新的“登录已取消”委托方法(此处提交:在develop branch中)
感谢您帮助我们改进Simperium 如果其他人遇到这种情况,如果不在simperium.h中实现一个自定义委托方法并使您的AppDelegate.h成为它的委托,就无法做到这一点。如果你需要密码,请告诉我。