A framework for building native applications using React
An attempt at resolving crash in RCTStringFromNSString
Summary: Changelog: [Internal] # Why we crash? `cStringUsingEncoding` returns `char *`, not `std::string`. Compiler uses implicit conversion to construct and copy `char *` into `std::string`. Maybe optimiser does something unexpected there? Maybe something weird happens there? I think it is worth trying to be more explicit about it and construct std::string there explicitly. Also if you do a google search, this seems to be a go to strategy when converting `NSString` to `std::string`. This is all just an assumption, I can't repro the crash # Why get rid of 2nd argument in RCTStringFromNSString 2nd argument is `NSStringEncoding`. It isn't being used, we always use default value. Also, if you pass in `NSUTF16StringEncoding` or `NSUTF32StringEncoding`, you get undefined behaviour. Check https://developer.apple.com/documentation/foundation/nsstring/1408489-cstringusingencoding?language=objc# section "Special Considerations" Reviewed By: shergin Differential Revision: D22089694 fbshipit-source-id: d449b383c61983c3822bc589c0a01fa97c0b6e64
S
Samuel Susla committed
93f9d8dd6b5fbd6a214f36853e8a007a7f34f5a9
Parent: 8e1b812
Committed by Facebook GitHub Bot <facebook-github-bot@users.noreply.github.com>
on 6/17/2020, 9:19:58 PM