gpt4 book ai didi

ios - UIAlertView 和 UIActionSheet buttonClicked - EXC_BAD_ACCESS

转载 作者:塔克拉玛干 更新时间:2023-11-02 20:13:50 25 4
gpt4 key购买 nike

我收到了两份关于 Crashlytics 的崩溃报告,日志相似,一份针对 UIAlertView,一份针对 UIActionSheet:

Exception Type: EXC_BAD_ACCESS Code: KERN_INVALID_ADDRESS at 0xa0000008

0 libobjc.A.dylib objc_msgSend + 15
1 UIKit -[UIAlertView(Private) _buttonClicked:] + 296
2 UIKit -[UIApplication sendAction:to:from:forEvent:] + 72
3 UIKit -[UIApplication sendAction:toTarget:fromSender:forEvent:] + 30
4 UIKit -[UIControl sendAction:to:forEvent:] + 44
5 UIKit -[UIControl(Internal) _sendActionsForEvents:withEvent:] + 502
6 UIKit -[UIControl touchesEnded:withEvent:] + 488
7 UIKit -[UIWindow _sendTouchesForEvent:] + 524
8 UIKit -[UIApplication sendEvent:] + 380
9 UIKit _UIApplicationHandleEvent + 6154
10 GraphicsServices _PurpleEventCallback + 590
11 GraphicsServices PurpleEventCallback + 34
12 ... CoreFoundation __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 34

我正在使用 ARC,在我的代码中,我在 View Controller 中分配/初始化警报 View 和操作表,将委托(delegate)设置为 self。我找不到问题的根源,有什么建议吗?

这是 SomeViewController.m 中的示例:

UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:NSLocalizedString(@"Are you sure?", nil) delegate:self cancelButtonTitle:NSLocalizedString(@"Continue",nil) destructiveButtonTitle:NSLocalizedString(@"Yes", nil) otherButtonTitles:nil];
actionSheet.delegate = self;
[actionSheet showInView:self.view];

结束我实现的 (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex

最佳答案

查找此类错误的最佳方法使用NSZombieEnabled 环境变量。EXC_BAD_ACCESS 的原因是试图访问已释放的对象。 Review this

关于ios - UIAlertView 和 UIActionSheet buttonClicked - EXC_BAD_ACCESS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16736388/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com