在iOS 4下,当我的应用程序从xcode安装时,它会在第一次启动时崩溃,但不会在次要启动时崩溃。
在评论出一些addSubView方法后,调试器终于给了我一条信息
它在[super viewDidLoad]上崩溃了。调试器声明:
无法访问变量“button1”
- (void)viewDidLoad {
[super viewDidLoad];
self.view.backgroundColor = [UIColor blackColor];
UIButton *button1 = [UIButton buttonWithType:UIButtonTypeCustom];
来自控制台的断点信息:
Pending breakpoint 1 - ""RootViewController.m":20" resolved
Pending breakpoint 2 - ""RootViewController.m":127" resolved
Pending breakpoint 3 - ""RootViewController.m":134" resolved
Pending breakpoint 4 - ""RootViewController.m":140" resolved
Pending breakpoint 5 - ""RootViewController.m":146" resolved
Pending breakpoint 6 - ""RootViewController.m":162" resolved
Pending breakpoint 7 - ""RootViewController.m":157" resolved
Pending breakpoint 8 - ""RootViewController.m":152" resolved
Pending breakpoint 9 - ""RootViewController.m":23" resolved
Pending breakpoint 10 - ""RootViewController.m":26" resolved
Pending breakpoint 11 - ""RootViewController.m":28" resolved
Pending breakpoint 12 - ""RootViewController.m":27" resolved
Pending breakpoint 13 - ""RootViewController.m":29" resolved
Pending breakpoint 14 - ""RootViewController.m":31" resolved
Pending breakpoint 15 - ""RootViewController.m":30" resolved
Pending breakpoint 16 - ""RootViewController.m":32" resolved
Pending breakpoint 17 - ""RootViewController.m":33" resolved
Pending breakpoint 18 - ""RootViewController.m":34" resolved
Pending breakpoint 19 - ""RootViewController.m":35" resolved
Pending breakpoint 20 - ""RootViewController.m":36" resolved
Pending breakpoint 21 - ""RootViewController.m":37" resolved
Pending breakpoint 22 - ""RootViewController.m":21" resolved
Pending breakpoint 23 - "objc_exception_throw" resolved
答案 0 :(得分:3)
尝试在调试模式下检查变量时,我遇到了同样的错误消息“无法访问变量”。
正如其中一条评论所述,我的问题是我正在调试我的发布版本而不是调试版本。