• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

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

[复制链接]
菜鸟教程小白 发表于 2022-12-12 09:56:49 | 显示全部楼层 |阅读模式 打印 上一主题 下一主题

我正在尝试找出我的应用出了什么问题。它在 Release模式下崩溃 EXC_BAD_ACCESS,但是当我尝试检查僵尸时,它不会通过仪器崩溃。毫无疑问,我关闭了僵尸检测并且它崩溃了。

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

- (void)viewDidLoad
{

    [super viewDidLoad];

    //load abstract
    if ( self.abstractId > 0 ){
        [self startQueryselector(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;

}

我还有哪些其他调试选项?

谢谢!



Best Answer-推荐答案


我猜是这一行:

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/

回复

使用道具 举报

懒得打字嘛,点击右侧快捷回复 【右侧内容,后台自定义】
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

关注0

粉丝2

帖子830918

发布主题
阅读排行 更多
广告位

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap