升级到iOS9后登录流程失败 [英] Login flow failing after upgrading to iOS9

查看:69
本文介绍了升级到iOS9后登录流程失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

将我的应用升级到iOS9后,我的应用出现错误,提示:

After upgrading my app to iOS9 I’am getting an error in my app which says:

:objc [344]:无法形成对LoginVC类的实例(0x15919e00)的弱引用.

以下是出现此错误的函数:

Below is the function in which i get this error:

-(void)dismissLogin {
self.isLoggingIn = NO;
[self stopLoginAnimation];
[self dismissViewControllerAnimated:YES completion:NO];
[[NSNotificationCenter defaultCenter] removeObserver:self];
[self.appDelegate setLoginVC:nil];
[self.view removeFromSuperview];
//[APPDEL selectTabBar];
}

该应用程序停留在登录屏幕上,并且不会切换到下一个屏幕.

The app gets stuck at the login screen and doesn't switch to next screens.

iOS8中没有此错误. 谁能帮我解决这个问题.

This error doesn’t come in iOS8. Can anyone help me with this issue.

推荐答案

确保您没有使用被释放的实例.

Make sure you are not using instance being deallocated.

我有同样的问题.它不是在iOS 8中发生,而是在iOS 9中发生.因为我像这样覆盖了setDelegate方法.

I have the same issue. It was not occurring in iOS 8 but occurred in iOS 9. Because I was overriding setDelegate method like this.

-(void)setDelegate:(id<UICollectionViewDelegate>)delegate{
    _internalDelegate = delegate;
    [super setDelegate:self];
}

因此在iOS 9中,操作系统在取消分配时将委托设置为nil,但我将其设置为self.如此迅速的解决方法是

So in iOS 9, OS sets delegate to nil on de-allocation, but I was setting it to self. So quick fix was

-(void)setDelegate:(id<UICollectionViewDelegate>)delegate{
    _internalDelegate = delegate;
    if (delegate) {
        //Set delegate to self only if original delegate is not nil
        [super setDelegate:self];
    }else{
        [super setDelegate:delegate];
    }
}

这篇关于升级到iOS9后登录流程失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆