We encountered a crash in ChuzzleKit (as used by PromiseKit) when URL encoding a string that came out of a text field. The issue here is that for performance reasons, UIKit hands out a pointer to the internal mutable string representation (which can be an NSBigMutableString for long strings) and we were handing that to PromiseKit.
To fix this in our app, we made an immutable copy of the string we get from the text field and use that to call PromiseKit.
However, it would be best if PromiseKit didn't cause a crash if someone does this.
The 'crash' is the following exception at line 16 of Chuzzle.m (the mutable string copy line [(id)self setString:s];):
*** Terminating app due to uncaught exception 'NSInvalidArgumentException',
reason: 'Attempt to mutate immutable object with replaceCharactersInRange:withString:'
You'd think an NSBigMutableString would be mutable based on its name, but apparently not in all cases (at least you can't always call setString: on it without this happening).
We encountered a crash in ChuzzleKit (as used by PromiseKit) when URL encoding a string that came out of a text field. The issue here is that for performance reasons, UIKit hands out a pointer to the internal mutable string representation (which can be an
NSBigMutableStringfor long strings) and we were handing that to PromiseKit.To fix this in our app, we made an immutable copy of the string we get from the text field and use that to call PromiseKit.
However, it would be best if PromiseKit didn't cause a crash if someone does this.
The 'crash' is the following exception at line 16 of Chuzzle.m (the mutable string copy line
[(id)self setString:s];):You'd think an
NSBigMutableStringwould be mutable based on its name, but apparently not in all cases (at least you can't always call setString: on it without this happening).