好吧,我完全被困住了,想知道有没有人能指出我犯了什么明显的错误。
我在项目中使用Simperium (dev分支),如果用户拒绝身份验证窗口,我希望在主AppDelegate中得到通知。
现在,在SPAutheticationManager.m文件中有以下代码:
- (void)cancel {
DDLogVerbose(@"Simperium authentication cancelled");
if ([delegate respondsToSelector:@selector(authenticationDidCancel)])
[delegate authenticationDidCancel];
}我设置了一个断点,当窗口被关闭时,这肯定会被调用。
现在,我已经将SPAuthenticationDelegate添加到AppDelegate中的实现中,然后将以下代码添加到AppDelegate.m中
-(void)authenticationDidCancel {
NSLog(@"Authetication Cancelled");
}但是,这不是在打电话,我也想不出为什么?
有人知道我在这里错过了什么吗?
谢谢
加雷斯
发布于 2013-08-05 15:31:03
如果其他人碰到这种情况,如果不在simperium.h中实现自定义委托方法并使AppDelegate.h成为它的委托,就无法做到这一点。
近况
- (void)didCancelAuth;然后在simperium.m authenticationDidCancel方法中添加:
if ([delegate respondsToSelector:@selector(didCancelAuth)]) {
[delegate didCancelAuth];
}然后将appDelegate设置为simperium的委托并添加:
- (void)didCancelAuth
{
//auth has been cancelled
}您还需要执行以下操作,以确保应用程序委托是委托
self.simperium.delegate = self;干杯
加雷斯
发布于 2014-01-09 16:35:50
只是想让您知道,我们刚刚添加了一个全新的‘登录取消’委托方法(提交此处:开发分支中的https://github.com/Simperium/simperium-ios/commit/5cae8a157786a48ffe1cc649f898341eb9cf51bf )。
感谢您帮助我们改进Simperium!
https://stackoverflow.com/questions/18045429
复制相似问题