【发布时间】:2014-01-06 07:50:57
【问题描述】:
我正在加载一个崩溃的 viewController (LandingViewController),因为 UIKit 出于某种原因正在释放我的“ConnectionStatus”对象,我正在尝试向它发送消息。
我的代码如下:
@property (nonatomic, strong) ConnectionStatus *cStatus;
- (void)viewDidLoad
{
[super viewDidLoad];
...
self.cStatus = [[ConnectionStatus alloc] init];
}
当我加载僵尸乐器时,我得到了这个:
UIKit 在我的视图控制器加载之前释放对象有什么原因吗?
更新(我如何加载这个视图控制器):
-(void)logout {
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Storyboard" bundle:nil];
LandingViewController *lvc = [storyboard instantiateViewControllerWithIdentifier:@"landingVC"];
[self presentViewController:lvc animated:YES completion:nil];
}
【问题讨论】:
-
登录按钮?有这个方法吗,如果有请分享一下
-
让我在没有登录按钮的情况下更新代码...恐怕会误导...
-
LandingViewController 好像被释放了,所以 cStatus 也被释放了。
-
你的 loginButton 正在释放你的 viewController 我不知道为什么
-
登录按钮代码基本上是调用cStatus.isHostReachable方法。我已经删除了那个电话,并更新了上面的图片。
标签: ios objective-c