2014-01-06 54 views
0

我加载了一个viewController(LandingViewController),因为我的'ConnectionStatus'对象由于某种原因被UIKit释放了,我试图向它发送一条消息。Viewcontroller释放我的对象

我的代码如下:

@property (nonatomic, strong) ConnectionStatus *cStatus; 

- (void)viewDidLoad 
{ 
    [super viewDidLoad]; 
    ... 
    self.cStatus = [[ConnectionStatus alloc] init]; 
} 

当我加载了僵尸工具,我得到这个: enter image description here

是否有一个原因,UIKit的是我的视图控制器之前重新分配的对象,即使负载?

UPDATE(我怎么加载这个视图控制器):

-(void)logout { 
    UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Storyboard" bundle:nil]; 
    LandingViewController *lvc = [storyboard instantiateViewControllerWithIdentifier:@"landingVC"]; 

    [self presentViewController:lvc animated:YES completion:nil]; 
} 
+0

loginButton?你有没有这种方法,如果是的话请分享 – Retro

+0

让我更新代码而无需登录按钮...我害怕可能会误导... – Allen

+0

似乎LandingViewController是交易所以cStatus也是交易。 – KudoCC

回答

0

的viewDidLoad中释放的是正确的;即ARC释放您创建并分配给强属性的对象。

该问题看起来是要么在您的ProfileViewController,要么在任何通知正在发送。该对象是您发布通知时的僵尸。您可能会错误地保留某些内容或将它用作通知对象(或拥有对象),但我们需要确认该代码。