Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is UICalloutBarButton, and why does it make my app crash?

Tags:

iphone

I'm going through some of the reported crash reports for my iPhone app, and I'm stumped by the following.

It's very possible it crashes somewhere in my code - it may be an event handler calling the wrong selector somewhere. The problem is I have no idea WHERE this code is - I don't know what a UICalloutBarButton or UICalloutBar is.

Also, needless to say, I can't reproduce this on my end, otherwise it'd be easy to figure out where it's happening.

Date/Time:       2011-03-18 14:33:13.373 +0100
OS Version:      iPhone OS 4.3 (8F190)
Report Version:  104

Exception Type:  EXC_CRASH (SIGABRT)
Exception Codes: 0x00000000, 0x00000000
Crashed Thread:  0

Thread 0 name:  Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0   libsystem_kernel.dylib          0x317aaa1c __pthread_kill + 8
1   libsystem_c.dylib               0x355593b4 pthread_kill
2   libsystem_c.dylib               0x35551bf8 abort
3   libstdc++.6.dylib               0x33378a64 __gnu_cxx::__verbose_terminate_handler() + 376
4   libobjc.A.dylib                 0x364b506c _objc_terminate
5   libstdc++.6.dylib               0x33376e36 __cxxabiv1::__terminate(void (*)()) + 46
6   libstdc++.6.dylib               0x33376e8a std::terminate() + 10
7   libstdc++.6.dylib               0x33376f5a __cxa_throw + 78
8   libobjc.A.dylib                 0x364b3c84 objc_exception_throw
9   CoreFoundation                  0x354e21b8 -[NSObject(NSObject) doesNotRecognizeSelector:]
10  CoreFoundation                  0x354e1642 ___forwarding___
11  CoreFoundation                  0x35458178 _CF_forwarding_prep_0 + 40
12  CoreFoundation                  0x3544befc -[NSObject(NSObject) performSelector:withObject:]
13  UIKit                           0x35e259b2 -[UICalloutBar buttonPressed:]
14  CoreFoundation                  0x3544befc -[NSObject(NSObject) performSelector:withObject:]
15  UIKit                           0x35e25cd4 -[UICalloutBarButton sendCallback]
16  Foundation                      0x31d096ce __NSFireDelayedPerform
17  CoreFoundation                  0x354b5a40 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__
18  CoreFoundation                  0x354b7ec4 __CFRunLoopDoTimer
19  CoreFoundation                  0x354b883e __CFRunLoopRun
20  CoreFoundation                  0x35448ebc CFRunLoopRunSpecific
21  CoreFoundation                  0x35448dc4 CFRunLoopRunInMode
22  GraphicsServices                0x328e8418 GSEventRunModal
23  GraphicsServices                0x328e84c4 GSEventRun
24  UIKit                           0x35bffd62 -[UIApplication _run]
25  UIKit                           0x35bfd800 UIApplicationMain
26  app name                        0x000022d0 main + 36
27  app name                        0x0000226c start + 44
like image 925
alex_c Avatar asked Apr 18 '11 22:04

alex_c


2 Answers

UICalloutBar is a UIKit private API.

I think this is the contextual menu that appears on text selection... (Copy/Paste...)

Anyway, this crash really likes coming from internal APIs.

So I guess that it is :

  • An apple bug (check the iOS versions vs crash occurences)
  • OR someone with a jailbroken device with dirty extensions/tweaks messing internal APIs

I'm afraid that the chances you find a fix for this are very low. I hope I'm wrong! :)

like image 115
Vincent Guerci Avatar answered Sep 29 '22 12:09

Vincent Guerci


I had a crash from this API too. I was allowing my tableView to copy cells which displays a context copy menu automatically.

The crash was the result of a user clicking the back button of the navigation bar instead of clicking this menu option. The menu doesn't get dismissed and stays floating on the window until someone taps it. By this time the UITableViewController subclass is popped off the navigation stack resulting in a message being sent to the deallocated instance.

This might be an Apple UIKit bug, I'm not sure. One solution is to dismiss the menu manually in your viewWillDisappear: method.

- (void)viewWillDisappear:(BOOL)animated
{
    [super viewWillDisappear:animated];
    [[UIMenuController sharedMenuController] setMenuVisible:NO animated:animated];
}
like image 36
Electron Avatar answered Sep 29 '22 13:09

Electron