gpt4 book ai didi

ios - 应用程序在 Release模式下崩溃,但在启用僵尸时不会崩溃

转载 作者:塔克拉玛干 更新时间:2023-11-02 09:59:03 24 4
gpt4 key购买 nike

我想弄清楚我的应用程序出了什么问题。它在 Release模式下使 EXC_BAD_ACCESS 崩溃,但当我尝试检查僵尸时,它不会通过仪器崩溃。毫无疑问,我关闭了僵尸检测,它崩溃了。

当它确实崩溃时,我唯一能知道的是 vm 分配中的最新调用显示了这个 viewDidLoad。所以我想知道这里是否有问题?

- (void)viewDidLoad
{

[super viewDidLoad];

//load abstract
if ( self.abstractId > 0 ){
[self startQuery:@selector(getAbstractWithId:)];
}

//setup nav bar
self.navigationItem.backBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"" style:UIBarButtonItemStylePlain target:nil action:nil];
[self.view addSubview:[self makeFavoriteButton]];


//add link attributes
self.linkAttributes = @{NSForegroundColorAttributeName: [UIColor colorWithHexString:emaGreen],
NSUnderlineColorAttributeName: [UIColor lightGrayColor],
NSUnderlineStyleAttributeName: @(NSUnderlinePatternSolid)};


//create text view
UITextView *tv = [[UITextView alloc] initWithFrame:self.view.frame];
tv.editable = NO;
tv.textAlignment = NSTextAlignmentLeft;
tv.text = @" ";
tv.backgroundColor = [UIColor whiteColor];
tv.scrollEnabled = YES;
tv.dataDetectorTypes = UIDataDetectorTypeLink;
tv.linkTextAttributes = self.linkAttributes; // customizes the appearance of links
tv.delegate = self;

// set the scroll indicators between nav and tabs
tv.scrollIndicatorInsets = UIEdgeInsetsMake(0,
0,
CGRectGetHeight(self.tabBarController.tabBar.frame),
0);

//add to property and view
self.tv = tv;
[self.view addSubview:tv];

//Create spinner view
MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:self.navigationController.view animated:YES];
hud.mode = MBProgressHUDModeIndeterminate;
self.hud = hud;

}

这里还有哪些其他调试选项?

谢谢!

最佳答案

我猜是这一行:

self.navigationItem.backBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@""style:UIBarButtonItemStylePlain target:nil action:nil];

引用UIControl参数的文档:

target: The target object—that is, the object to which the action message is sent. If this is nil, the responder chain is searched for an object willing to respond to the action message

action: A selector identifying an action message. It cannot be NULL

奇怪的是,这不是为 UIBarButtonItem 的初始化程序指定的,但我看不出为什么它在那里也不应该是真的,除非该类实际检查这些参数是否为 null 并做出相应的行为。

也许您的条形按钮项目正试图访问 null 选择器以发送它并在那里崩溃,或者正试图将它发送到某个已被释放的对象。这可能只能通过某些优化来实现——例如,作为优化,可能在 Release模式下,按钮会获取指向消息发送调用的函数的指针,而不是发送消息。

至少,传递 nil 似乎是个错误。

关于ios - 应用程序在 Release模式下崩溃,但在启用僵尸时不会崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33978604/

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