Description
(I'm aware that v3.2.0 is intended to be the last 3.x release, and that v4 has removed all native code and uses Node.js instead, so I understand if this bug won't be fixed.)
#145 (which has now been merged into the 3.x branch) introduced this code in the handler for the --devicetypeid
option in Source/iPhoneSimulator.m
:
if (![deviceTypeId containsString:deviceTypeIdPrefix]) {
deviceTypeId = [deviceTypeIdPrefix stringByAppendingString:deviceTypeId];
}
containsString
was introduced in Yosemite:
NSString now has the following two convenience methods:
- (BOOL)containsString:(NSString *)str; - (BOOL)localizedCaseInsensitiveContainsString:(NSString *)str;
containsString: returns YES if the target string is contained within the receiver. This is the same as calling rangeOfString:options: with no options, thus doing a case-sensitive, non-literal search.
So when the --devicetypeid
option is used on Mavericks, a crash occurs:
node_modules/.bin/ios-sim launch Simulator-4.0.3.app --devicetypeid iPhone-6
2015-07-30 11:55:14.775 ios-sim[19650:507] -[__NSCFString containsString:]: unrecognized selector sent to instance 0x7ffbdb601040
2015-07-30 11:55:14.777 ios-sim[19650:507] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFString containsString:]: unrecognized selector sent to instance 0x7ffbdb601040'
*** First throw call stack:
(
0 CoreFoundation 0x00007fff9139925c __exceptionPreprocess + 172
1 libobjc.A.dylib 0x00007fff8d2ade75 objc_exception_throw + 43
2 CoreFoundation 0x00007fff9139c12d -[NSObject(NSObject) doesNotRecognizeSelector:] + 205
3 CoreFoundation 0x00007fff912f7272 ___forwarding___ + 1010
4 CoreFoundation 0x00007fff912f6df8 _CF_forwarding_prep_0 + 120
5 ios-sim 0x0000000106e824b5 -[iPhoneSimulator runWithArgc:argv:] + 1325
6 ios-sim 0x0000000106e82e1a main + 101
7 ios-sim 0x0000000106e80020 start + 52
)
libc++abi.dylib: terminating with uncaught exception of type NSException
Abort trap: 6
I think this bug could easily be fixed by using rangeOfString
instead of containsString
.
$ sw_vers -productVersion
10.9.5
$ node_modules/.bin/ios-sim --version
3.2.0
$ xcodebuild -version
Xcode 6.2
Build version 6C131e
$ xcode-select --print-path
/Applications/Xcode.app/Contents/Developer
$ gcc --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 6.0 (clang-600.0.57) (based on LLVM 3.5svn)
Target: x86_64-apple-darwin13.4.0
Thread model: posix