I am running instruments via Terminal:
instruments -t /Developer/Platforms/"iPhoneOS.platform/Developer/Library/Instruments/PlugIns/Au‌​tomationInstrument.bundle/Contents/Resources/Automation.tracetemplate ~/Library/Application\\\ Support/iPhone\\\ Simulator/$simulatorSDKVersion/Applications/<randomUUID>/MyApp.app -e UIASCRIPT someJSFile.js -e UIARESULTSPATH Logs
for several test scripts.
But I keep getting sporadic crashes and this is interfering with the workflow I have set up.
Can anyone tell me what this means:
instruments[57679:1603] InstrumentsException : *** -[__NSCFString stringByAppendingString:]: nil argument
instruments[57679:1603] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSCFString stringByAppendingString:]: nil argument'
*** First throw call stack:
(
0 CoreFoundation 0x00007fff90ed4f56 __exceptionPreprocess + 198
1 libobjc.A.dylib 0x00007fff90598d5e objc_exception_throw + 43
2 CoreFoundation 0x00007fff90ed4d8a +[NSException raise:format:arguments:] + 106
3 CoreFoundation 0x00007fff90ed4d14 +[NSException raise:format:] + 116
4 Foundation 0x00007fff939e9375 -[NSString stringByAppendingString:] + 91
5 AutomationInstrument 0x000000010c5b6695 AutomationInstrument + 30357
6 libdispatch.dylib 0x00007fff8ad07a86 _dispatch_call_block_and_release + 18
7 libdispatch.dylib 0x00007fff8ad098f6 _dispatch_main_queue_callback_4CF + 308
8 CoreFoundation 0x00007fff90e69e7c __CFRunLoopRun + 1724
9 CoreFoundation 0x00007fff90e69486 CFRunLoopRunSpecific + 230
10 Foundation 0x00007fff939d7f7b -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 267
11 Foundation 0x00007fff93a5bb56 -[NSRunLoop(NSRunLoop) runUntilDate:] + 66
12 instruments 0x00000001091d03c1 _mh_execute_header + 13249
13 instruments 0x00000001091ce194 _mh_execute_header + 4500
)
terminate called throwing an exception
Thanks!
P.S. Not sure if this is the right site to post this question on.
Best Answer
I've seen that Exception before when I throw a Javascript primitive and it reproduces reliably and consistently with my Instruments-4.5 (4523).
Your comments state that this does not reproduce reliably. Is it possible that your tests do not take the same path reliably (and hence, not consistently throwing), and this is why they only reproduce sometimes? Before continuing, I suggest verifying that your tests are taking the same path consistently.
To verify throwing a Javascript primitive is the case with your tests, do these steps.
Find a Javascript test file that reproduces with your InstrumentsException.
Verify the Javascript test throws a Javascript primitive, as opposed to a Javascript Object. Specifically, you want a line that uses "throw" but does not use "new" in the same line. The relevant line should look like this,
not
Verify that your installation does actually throw that specific InstrumentsException when you throw a primitive.
At this point, you've got a pretty good suspect. But you to make more certain, try removing the suspicious "throw" line or replacing it with something else, just to see if you can get the test to pass.