marcoarment / BugshotKit

iOS in-app bug reporting for developers and testers, with annotated screenshots and the console log.
MIT License
1.36k stars 129 forks source link

Unrecognised selector crash using blur tool #24

Closed ratkins closed 10 years ago

ratkins commented 10 years ago
2014-02-14 14:27:11.487 Sideline[8664:60b] [BugshotKit] Console font not found. Please add Inconsolata.otf to your Resources.
2014-02-14 14:27:19.582 Sideline[8664:60b] [BugshotKit] Enabled for 2-finger swipe down.
2014-02-14 14:27:23.400 Sideline[8664:60b] [BugshotKit] Enabled for 2-finger swipe down.
2014-02-14 14:27:38.554 Sideline[8664:60b] -[UIImage applyBlurWithRadius:tintColor:saturationDeltaFactor:maskImage:]: unrecognized selector sent to instance 0x1712a390
2014-02-14 14:27:38.557 Sideline[8664:60b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIImage applyBlurWithRadius:tintColor:saturationDeltaFactor:maskImage:]: unrecognized selector sent to instance 0x1712a390'
*** First throw call stack:
(0x2fe02e83 0x3a1636c7 0x2fe067b7 0x2fe050af 0x2fd53dc8 0x872a9 0x32606dd9 0x3223ca79 0x32226243 0x323002ed 0x32225af3 0x322257a7 0x32209369 0x32209001 0x32208a0d 0x3220881f 0x3220254d 0x2fdcdf69 0x2fdcb8f7 0x2fdcbc43 0x2fd36471 0x2fd36253 0x34a6a2eb 0x325eb845 0x80539 0x3a65cab7)
libc++abi.dylib: terminating with uncaught exception of type NSException

I got this soon after launching the app, just trying out all three tools. If it's at all interesting, my app was in the middle of pushing a new view controller when I managed to trigger Bugshot.

ratkins commented 10 years ago

Oh, one more thing; I had also just gone to send a Bugshot mail, but then cancelled out of the mail composer.

ratkins commented 10 years ago

Once again with feeling (and a stack trace, maybe because I was running in the simulator, with the Bugshot project open?)

2014-02-14 14:51:42.265 Sideline[2360:70b] -[UIImage applyBlurWithRadius:tintColor:saturationDeltaFactor:maskImage:]: unrecognized selector sent to instance 0xbfbed70
2014-02-14 14:51:42.306 Sideline[2360:70b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIImage applyBlurWithRadius:tintColor:saturationDeltaFactor:maskImage:]: unrecognized selector sent to instance 0xbfbed70'
*** First throw call stack:
(
    0   CoreFoundation                      0x01abe5e4 __exceptionPreprocess + 180
    1   libobjc.A.dylib                     0x016d08b6 objc_exception_throw + 44
    2   CoreFoundation                      0x01b5b903 -[NSObject(NSObject) doesNotRecognizeSelector:] + 275
    3   CoreFoundation                      0x01aae90b ___forwarding___ + 1019
    4   CoreFoundation                      0x01aae4ee _CF_forwarding_prep_0 + 14
    5   Sideline                            0x0003e61b -[BSKAnnotationBlurView drawRect:] + 539
    6   UIKit                               0x004a8d56 -[UIView(CALayerDelegate) drawLayer:inContext:] + 504
    7   QuartzCore                          0x02d43dc9 -[CALayer drawInContext:] + 123
    8   QuartzCore                          0x02d43cfa _ZL16backing_callbackP9CGContextPv + 96
    9   QuartzCore                          0x02c34cf4 CABackingStoreUpdate_ + 2656
    10  QuartzCore                          0x02d43c92 ___ZN2CA5Layer8display_Ev_block_invoke + 93
    11  QuartzCore                          0x02d77b23 x_blame_allocations + 15
    12  QuartzCore                          0x02d43afd _ZN2CA5Layer8display_Ev + 1519
    13  QuartzCore                          0x02d43d49 -[CALayer _display] + 33
    14  QuartzCore                          0x02d43506 _ZN2CA5Layer7displayEv + 144
    15  QuartzCore                          0x02d43d23 -[CALayer display] + 33
    16  QuartzCore                          0x02d37ed3 _ZN2CA5Layer17display_if_neededEPNS_11TransactionE + 323
    17  QuartzCore                          0x02d37f4c _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 38
    18  QuartzCore                          0x02c9fae6 _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 294
    19  QuartzCore                          0x02ca0e71 _ZN2CA11Transaction6commitEv + 393
    20  QuartzCore                          0x02ca1544 _ZN2CA11Transaction17observer_callbackEP19__CFRunLoopObservermPv + 92
    21  CoreFoundation                      0x01a864ce __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 30
    22  CoreFoundation                      0x01a8641f __CFRunLoopDoObservers + 399
    23  CoreFoundation                      0x01a64344 __CFRunLoopRun + 1076
    24  CoreFoundation                      0x01a63ac3 CFRunLoopRunSpecific + 467
    25  CoreFoundation                      0x01a638db CFRunLoopRunInMode + 123
    26  GraphicsServices                    0x02b1c9e2 GSEventRunModal + 192
    27  GraphicsServices                    0x02b1c809 GSEventRun + 104
    28  UIKit                               0x0043ed3b UIApplicationMain + 1225
    29  Sideline                            0x0003910d main + 141
    30  libdyld.dylib                       0x03bc170d start + 1
    31  ???                                 0x00000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException

I can confirm this is repeatable on an iPhone 5s and the 64 bit and 32 bit simulators.

ratkins commented 10 years ago

Ok, I've worked it out.

The unrecognised method was defined on a category and, because the category was included in a static library, it wasn't being linked properly. To fix this you need to add the -ObjC flag to the "Other Linker Flags" of the project that uses the static library along with the -lBugshotKit. This could probably be noted in the README.md.

As an aside, in order to make a .a that would work in simulator builds I had to set BugshotKit's Build Active Architecture Only to No for Debug and Release builds. Should that be made the default?