是什么导致我的 EXC_BAD_ACCESS? (iPhone SDK)

发布于 2024-11-28 02:43:24 字数 2757 浏览 1 评论 0原文

- (IBAction)startSignin:(id)sender {
    Login *aview = [[Login alloc] init];
    aview.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
    [self.navigationController presentModalViewController:aview animated:YES];

    [_window addSubview:aview.view];
    [aview release];
}

是什么导致我的 EXC 访问错误?

每次加载登录时,只要我按下该页面上的按钮或其他内容,它就会崩溃。

*** Call stack at first throw:
(
    0   CoreFoundation                      0x00dc25a9 __exceptionPreprocess + 185
    1   libobjc.A.dylib                     0x00f16313 objc_exception_throw + 44
    2   CoreFoundation                      0x00d7aef8 +[NSException raise:format:arguments:] + 136
    3   CoreFoundation                      0x00d7ae6a +[NSException raise:format:] + 58
    4   UIKit                               0x000c6709 -[UIViewController _loadViewFromNibNamed:bundle:] + 295
    5   UIKit                               0x000c4134 -[UIViewController loadView] + 120
    6   UIKit                               0x000c400e -[UIViewController view] + 56
    7   UIKit                               0x00037d42 -[UIWindow addRootViewControllerViewIfPossible] + 51
    8   Test                           0x00001b3c -[TestAppDelegate application:didFinishLaunchingWithOptions:] + 220
    9   UIKit                               0x00014c89 -[UIApplication _callInitializationDelegatesForURL:payload:suspended:] + 1163
    10  UIKit                               0x00016d88 -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 439
    11  UIKit                               0x00021617 -[UIApplication handleEvent:withNewEvent:] + 1533
    12  UIKit                               0x00019abf -[UIApplication sendEvent:] + 71
    13  UIKit                               0x0001ef2e _UIApplicationHandleEvent + 7576
    14  GraphicsServices                    0x00ffb992 PurpleEventCallback + 1550
    15  CoreFoundation                      0x00da3944 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 52
    16  CoreFoundation                      0x00d03cf7 __CFRunLoopDoSource1 + 215
    17  CoreFoundation                      0x00d00f83 __CFRunLoopRun + 979
    18  CoreFoundation                      0x00d00840 CFRunLoopRunSpecific + 208
    19  CoreFoundation                      0x00d00761 CFRunLoopRunInMode + 97
    20  UIKit                               0x000167d2 -[UIApplication _run] + 623
    21  UIKit                               0x00022c93 UIApplicationMain + 1160
    22  Test                           0x00001a29 main + 121
    23  Test                           0x000019a5 start + 53
)
terminate called throwing an exceptionCurrent language:  auto; currently objective-c
- (IBAction)startSignin:(id)sender {
    Login *aview = [[Login alloc] init];
    aview.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
    [self.navigationController presentModalViewController:aview animated:YES];

    [_window addSubview:aview.view];
    [aview release];
}

What is causing my EXC BAD ACCESS?

Every time it loads Login, It crashes whenever i press a button or something on that page.

*** Call stack at first throw:
(
    0   CoreFoundation                      0x00dc25a9 __exceptionPreprocess + 185
    1   libobjc.A.dylib                     0x00f16313 objc_exception_throw + 44
    2   CoreFoundation                      0x00d7aef8 +[NSException raise:format:arguments:] + 136
    3   CoreFoundation                      0x00d7ae6a +[NSException raise:format:] + 58
    4   UIKit                               0x000c6709 -[UIViewController _loadViewFromNibNamed:bundle:] + 295
    5   UIKit                               0x000c4134 -[UIViewController loadView] + 120
    6   UIKit                               0x000c400e -[UIViewController view] + 56
    7   UIKit                               0x00037d42 -[UIWindow addRootViewControllerViewIfPossible] + 51
    8   Test                           0x00001b3c -[TestAppDelegate application:didFinishLaunchingWithOptions:] + 220
    9   UIKit                               0x00014c89 -[UIApplication _callInitializationDelegatesForURL:payload:suspended:] + 1163
    10  UIKit                               0x00016d88 -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 439
    11  UIKit                               0x00021617 -[UIApplication handleEvent:withNewEvent:] + 1533
    12  UIKit                               0x00019abf -[UIApplication sendEvent:] + 71
    13  UIKit                               0x0001ef2e _UIApplicationHandleEvent + 7576
    14  GraphicsServices                    0x00ffb992 PurpleEventCallback + 1550
    15  CoreFoundation                      0x00da3944 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 52
    16  CoreFoundation                      0x00d03cf7 __CFRunLoopDoSource1 + 215
    17  CoreFoundation                      0x00d00f83 __CFRunLoopRun + 979
    18  CoreFoundation                      0x00d00840 CFRunLoopRunSpecific + 208
    19  CoreFoundation                      0x00d00761 CFRunLoopRunInMode + 97
    20  UIKit                               0x000167d2 -[UIApplication _run] + 623
    21  UIKit                               0x00022c93 UIApplicationMain + 1160
    22  Test                           0x00001a29 main + 121
    23  Test                           0x000019a5 start + 53
)
terminate called throwing an exceptionCurrent language:  auto; currently objective-c

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

罗罗贝儿 2024-12-05 02:43:24

这通常是由于在释放对象后访问该对象而引起的。这也是熟悉调试器的一个好点。在按钮操作方法的第一行设置一个断点,并单步调试它以找出哪一行是坏的。

这次,我怀疑是您对 addSubview: 的调用,presentModal... 将负责呈现视图。

This is frequently caused by accessing an object after it is released. This is a good point to familiarize yourself with the debugger, too. Set a break point on the first line of the button action method, and step through it to find out which line is bad.

This time, i suspect it is your call to addSubview:, the presentModal… will take care of presenting the view.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文