iOS crash libobjc.A.dylib objc_msgSend

14,966

After much searching in the code, I stumbled across another post on here objc_msgSend [__NSArrayM dealloc] crash report sometimes from Crashlytics.

It seems that Crashlytics had a bug in 3.0.9, and was the cause of this issue.

Updated the SDK and all now okay.

Share:
14,966
NeilMortonNet
Author by

NeilMortonNet

iOS developer. Worked in IT for many years, involving coding, fault finding, design etc.

Updated on July 26, 2022

Comments

  • NeilMortonNet
    NeilMortonNet almost 2 years

    I am getting the crash shown below in Crashlytics.

    I am unable to understand where this is coming form within the app. Unfortunately I have never been able to generate this crash myself, but it is occurring in the wild.

    There is only one reference to the app name, and there is nothing that leads to show where in the app this is coming from.

    Is the fact that there is no data as to where in the app this occurs, an indication of an issue occurring during didFinishLaunchingWithOptionsand thus not actually getting far enough to show any further detail? Or is there some other reason that the log is lacking in data to show where the issue is?

    Could anyone advise how I may be able to track this down?

        Thread : Crashed: com.apple.main-thread
    0  libobjc.A.dylib                0x0000000195de3bd0 objc_msgSend + 16
    1  CoreFoundation                 0x0000000183fd9458 CFRelease + 524
    2  CoreFoundation                 0x0000000183fe5a18 -[__NSArrayM dealloc] + 152
    3  libobjc.A.dylib                0x0000000195de9724 (anonymous namespace)::AutoreleasePoolPage::pop(void*) + 564
    4  CoreFoundation                 0x0000000183fdd074 _CFAutoreleasePoolPop + 28
    5  Foundation                     0x0000000184f0e588 -[NSAutoreleasePool release] + 148
    6  UIKit                          0x0000000188be03f4 -[UIApplication _run] + 588
    7  UIKit                          0x0000000188bdaf40 UIApplicationMain + 1488
    8  _THE_APP_NAME_                 0x0000000100031e20 main (main.m:16)
    9  libdyld.dylib                  0x000000019647aa08 start + 4
    
    Crashed: com.apple.main-thread
    EXC_BAD_ACCESS KERN_INVALID_ADDRESS at 0x00000000f5b2beb8
    

    I am adding the following in relation the comments placed on this thread. This code was the main UI related change, other than usual label setting etc, which I can't see an issue with.

    The code below was added to the AppDelegate.m, DidFinishLaunchingWithOptions.

    I am wondering, as the crash is not something I have been able to re-produce, and whilst happening daily is only in a handful of cases, if it could be a timing issue, and the UI not being available to receive the messages.

    I welcome any thoughts, and if you agree, if I should instead move the code to the ViewDidLoad in the ViewController instead.

    [[UITabBarItem appearance] setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:
                                                                   [UIColor lightGrayColor], NSForegroundColorAttributeName,
                                                                   [UIFont fontWithName:@"Helvetica Neue" size:16],
                                                                   NSFontAttributeName, nil] forState:UIControlStateNormal];
                [[UITabBarItem appearance] setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:
                                                                   [UIColor darkGrayColor], NSForegroundColorAttributeName,
                                                                   [UIFont fontWithName:@"Helvetica Neue" size:16],
                                                                   NSFontAttributeName,
                                                                   nil] forState:UIControlStateSelected];
    
        [[UITabBar appearance] setBarTintColor:[UIColor colorWithRed:0.44 green:0.99 blue:0.45 alpha:1]];
    
        [[UINavigationBar appearance] setBarTintColor:[UIColor colorWithRed:0.44 green:0.99 blue:0.45 alpha:1]];
    
        [[UINavigationBar appearance] setTintColor:[UIColor darkGrayColor]];
    
        [[UINavigationBar appearance] setTitleTextAttributes:@{NSForegroundColorAttributeName : [UIColor darkGrayColor], NSFontAttributeName : [UIFont fontWithName:@"Helvetica Neue" size:22]}];
    
        [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];
    
  • NeilMortonNet
    NeilMortonNet almost 9 years
    Firstly, thank you for your response. May I ask how you know? (I am not questioning you, but trying to understand myself!). Is it the fact that the calls are within UIKit, Foundation & CoreFoundation, and not actually in any of my code? Also, is there anyway I can locate where within my app this is occurring so I could perhaps go a different route to get around the issue?
  • charlyatwork
    charlyatwork almost 9 years
    That's right, CorefFoundation/libobj.A.dylib sends a message to a point in memory where there is no instance of a class to execute it. With this crash report you don't have a change to spot the location in your code where it happens. It just can be said for sure that it's caused by an object which is part of the UIKit (e.g.: UILabel, UINavigationBar, UIImageView etc.)
  • NeilMortonNet
    NeilMortonNet almost 9 years
    Thank you. I really appreciate you taking the time to explain and also to hint at where the issue could be. I say this as the issue did not exist until an update in the app, so I will have a look at the changes and see what I may uncover. Of course, the issue is that I am totally unable to re-create this error myself, and thus narrowing it down is like finding the needle in the haystack! Thank you again.
  • NeilMortonNet
    NeilMortonNet almost 9 years
    I have looked at my code, and the main UI changes that were made in the update are those that I am adding into the edit on the main question now. These are all called from within DidFinishLaunchingWithOptions. I am wondering if there is a timing type issue, whereby the UI isn't actually available on occasions (slow device?) and thus the receiver (UI) isn't there. I would welcome your thoughts? And if you feel this could be the case, should I shift these calls to ViewDidLoad on the initial View Controller instead?
  • atkayla
    atkayla about 7 years
    I think I am getting something very similar here: stackoverflow.com/questions/43688667/… Except I use InstaBug instead.