Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v3.2.0: --devicetypeid option is broken on Mavericks #170

Open
michaelhogg opened this issue Jul 30, 2015 · 1 comment
Open

v3.2.0: --devicetypeid option is broken on Mavericks #170

michaelhogg opened this issue Jul 30, 2015 · 1 comment
Labels

Comments

@michaelhogg
Copy link

(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
@shazron
Copy link

shazron commented Aug 15, 2015

Ouch! I'll try to put out a patch for the 3.x series, 3.2.1. There's no reason that API call is critical anyway :)

@shazron shazron added this to the 3.2.1 milestone Aug 15, 2015
@shazron shazron added the bug label Aug 15, 2015
@shazron shazron removed this from the 3.2.1 milestone Dec 6, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants