1

我在 iOS6、iOS5 中的代码工作正常,但是在我安装 xcode5 并在 iOS7 中运行我的应用程序之后。该应用程序在 [alert show] 行中崩溃。错误信息是:线程 1:EXC_BAD_ACCESS (code=1, address=0x3)

我不知道为什么。任何人都可以帮助我。谢谢!

我的代码:

- (void) whetherRememberDialog{

dialogFlag = WHETHER_REMEMBER_DIALOG;

    NSString *titleInfo = @"Whether remember?";
    NSString *cancelInfo = @"cancel";
    NSString *okInfo = @"Ok";

    UIAlertView *storeQuesitonDialog = [[UIAlertView alloc] initWithTitle:titleInfo
                                                                  message:nil
                                                                 delegate:self
                                                        cancelButtonTitle:cancelInfo
                                                        otherButtonTitles:okInfo, nil];
    //[storeQuesitonDialog show];
    [storeQuesitonDialog performSelectorOnMainThread:@selector(show) withObject:nil waitUntilDone:YES]; // In this line the app is crash this codes 
    [storeQuesitonDialog release];

}

崩溃日志:

* thread #1: tid = 0xa6608, 0x3ac2fb62 libobjc.A.dylib`objc_msgSend + 2, queue = 'com.apple.main-thread, stop reason = EXC_BAD_ACCESS (code=1, address=0x3)
frame #0: 0x3ac2fb62 libobjc.A.dylib`objc_msgSend + 2
frame #1: 0x330d2ab0 UIKit`-[UIImageView _shouldTreatImageAsTemplate:] + 24
frame #2: 0x330d2a78 UIKit`-[UIImageView _effectiveTintColorWithImage:] + 24
frame #3: 0x330d3980 UIKit`-[UIImageView tintColorDidChange] + 80
frame #4: 0x330ccc2a UIKit`-[UIView(Internal) _recursiveNotifyInteractionTintColorDidChangeForReasons:] + 98
frame #5: 0x330ccce8 UIKit`-[UIView(Internal) _recursiveNotifyInteractionTintColorDidChangeForReasons:] + 288
frame #6: 0x330ccce8 UIKit`-[UIView(Internal) _recursiveNotifyInteractionTintColorDidChangeForReasons:] + 288
frame #7: 0x330ccce8 UIKit`-[UIView(Internal) _recursiveNotifyInteractionTintColorDidChangeForReasons:] + 288
frame #8: 0x330ccce8 UIKit`-[UIView(Internal) _recursiveNotifyInteractionTintColorDidChangeForReasons:] + 288
frame #9: 0x330ccce8 UIKit`-[UIView(Internal) _recursiveNotifyInteractionTintColorDidChangeForReasons:] + 288
frame #10: 0x330ccce8 UIKit`-[UIView(Internal) _recursiveNotifyInteractionTintColorDidChangeForReasons:] + 288
frame #11: 0x330ccce8 UIKit`-[UIView(Internal) _recursiveNotifyInteractionTintColorDidChangeForReasons:] + 288
frame #12: 0x330ccce8 UIKit`-[UIView(Internal) _recursiveNotifyInteractionTintColorDidChangeForReasons:] + 288
frame #13: 0x330ccce8 UIKit`-[UIView(Internal) _recursiveNotifyInteractionTintColorDidChangeForReasons:] + 288
frame #14: 0x332d60ea UIKit`-[_UIModalItemsPresentingViewController _desaturateUI] + 210
frame #15: 0x332d18f0 UIKit`-[_UIModalItemsPresentingViewController _dismissItem:andPresentItem:animated:completion:keepDimmingView:] + 416
frame #16: 0x332d174a UIKit`-[_UIModalItemsPresentingViewController _dismissItem:andPresentItem:animated:completion:] + 38
frame #17: 0x332d0f6e UIKit`-[_UIModalItemsCoordinator _presentItem:replacingItem:inViewController:animated:] + 1198
frame #18: 0x332d0aa8 UIKit`-[UIViewController(UIModalItemPresentationSupport) presentModalItem:replacing:animated:dontPresentAndAddToStack:] + 120
frame #19: 0x332d0a2c UIKit`-[UIViewController(UIModalItemPresentationSupport) presentModalItem:animated:] + 32
frame #20: 0x332cf77c UIKit`-[UIAlertView(Private) popupAlertAnimated:animationType:atOffset:] + 968
frame #21: 0x332cf3ae UIKit`-[UIAlertView(Private) popupAlertAnimated:animationType:] + 34
frame #22: 0x3126f19c Foundation`-[NSObject(NSThreadPerformAdditions) performSelector:onThread:withObject:waitUntilDone:modes:] + 744
frame #23: 0x31272b54 Foundation`-[NSObject(NSThreadPerformAdditions) performSelectorOnMainThread:withObject:waitUntilDone:] + 136
frame #24: 0x000dd7f0 PPExam`-[ExamPageViewController whetherRememberDialog](self=0x16e9c930, _cmd=0x001fa7ec) + 316 at ExamPageViewController.m:1043
frame #25: 0x000dbbb8 PPExam`-[ExamPageViewController backToChapterNaviController:](self=0x16e9c930, _cmd=0x001fa802, sender=0x16ea5870) + 68 at ExamPageViewController.m:743
frame #26: 0x330f555e UIKit`-[UIApplication sendAction:to:from:forEvent:] + 90
frame #27: 0x330f54fa UIKit`-[UIApplication sendAction:toTarget:fromSender:forEvent:] + 38
frame #28: 0x330f54ca UIKit`-[UIControl sendAction:to:forEvent:] + 46
frame #29: 0x330e10f2 UIKit`-[UIControl _sendActionsForEvents:withEvent:] + 374
frame #30: 0x330f4f12 UIKit`-[UIControl touchesEnded:withEvent:] + 594
frame #31: 0x330f4bdc UIKit`-[UIWindow _sendTouchesForEvent:] + 528
frame #32: 0x330efc08 UIKit`-[UIWindow sendEvent:] + 832
frame #33: 0x330c4f58 UIKit`-[UIApplication sendEvent:] + 196
frame #34: 0x330c3746 UIKit`_UIApplicationHandleEventQueue + 7114
frame #35: 0x30905f26 CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 14
frame #36: 0x309053ee CoreFoundation`__CFRunLoopDoSources0 + 206
frame #37: 0x30903bde CoreFoundation`__CFRunLoopRun + 630
frame #38: 0x3086e540 CoreFoundation`CFRunLoopRunSpecific + 524
frame #39: 0x3086e322 CoreFoundation`CFRunLoopRunInMode + 106
frame #40: 0x355a52ea GraphicsServices`GSEventRunModal + 138
frame #41: 0x331251e4 UIKit`UIApplicationMain + 1136
frame #42: 0x000b6ce0 PPExam`main(argc=1, argv=0x27d51c7c) + 100 at main.m:14
4

1 回答 1

-1

由于 ARC,您无法在 iOS 7 中手动释放对象。ARC 为您管理对象释放,因此您不应释放该对象。这可能会导致 ARC 在您已经释放对象之后释放对象,从而引发错误。另外,如果您释放警报视图,它应该如何显示在屏幕上?删除版本可能会为您解决此问题。

于 2013-10-31T18:48:37.707 回答