TextExpander / TextExpanderTouchSDK

TextExpander touch SDK
85 stars 13 forks source link

Method -(id)deepMutableCopy in category NSArray(SMOFExtensions) linked in from TextExpander.framework crashes with NSNumber #7

Closed alalani closed 9 years ago

alalani commented 10 years ago

Category methods on Apple classes should have prefixes to avoid collisions. Same goes for my code, since I found the bug because I didn't prefix my deepMutableCopy methods and they ended up calling the SMOFExtensions version of them. I will prefix my methods to solve this problem in my own code, but am filing this bug so SmileSoftware knows about it in their code.

The deepMutableCopy method has a bug where if your array has NSNumber objects in it, it crashes because it tries to call deepMutableCopy on them which they don't respond to.

Here's the relevant stack trace and exception:

2014-07-16 14:48:32.616 TextExpanderDeepMutableCopy[77441:60b] -[NSCFNumber mutableCopyWithZone:]: unrecognized selector sent to instance 0x94169b0 2014-07-16 14:48:32.618 TextExpanderDeepMutableCopy[77441:60b] * Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSCFNumber mutableCopyWithZone:]: unrecognized selector sent to instance 0x94169b0' *\ First throw call stack: ( 0 CoreFoundation 0x01e6c1e4 exceptionPreprocess + 180 1 libobjc.A.dylib 0x01beb8e5 objc_exception_throw + 44 2 CoreFoundation 0x01f09243 -[NSObject(NSObject) doesNotRecognizeSelector:] + 275 3 CoreFoundation 0x01e5c50b __forwarding** + 1019 4 CoreFoundation 0x01e5c0ee _CF_forwarding_prep_0 + 14 5 libobjc.A.dylib 0x01bfdc0b -[NSObject mutableCopy] + 41 6 TextExpanderDeepMutableCopy 0x000248be -[NSArray(SMOFExtensions) deepMutableCopy] + 403

SmilinBrian commented 9 years ago

Fixed with the 3.0 version of the SDK, and I think we've caught all the other class extension overrides.