I launch my iOS app on the device (not simulator) with the following command (app is already installed).
instruments \
-w c717fa22472d7b691ae5763af90e1e44244ad85a \
-t /Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/PlugIns/AutomationInstrument.bundle/Contents/Resources/Automation.tracetemplate \
-D "/Users/mj/Desktop/apps/trace" \
LPSimpleExample-cal \
-e UIARESULTSPATH /Users/mj/Desktop/apps \
-e UIASCRIPT /Users/mj/Desktop/apps/_run_loop.js
6 out of 10 times it is working. In case of an error I get the following message:
2013-10-07 16:45:51.553 instruments[9891:1207] unable to locate CFBundleIdentifier for path: LPSimpleExample-cal
2013-10-07 16:45:51.555 instruments[9891:1207] Recording cancelled : At least one target failed to launch; aborting run
Instruments Trace Error : Error Domain=com.apple.instruments Code=1 "Error Starting Recording" UserInfo=0x7faccbef8fa0 {NSLocalizedDescription=Error Starting Recording, NSLocalizedRecoverySuggestion=At least one target failed to launch; aborting run}
Instruments Trace Error : Failed to start trace.
For me it looks that instruments has a bug here. I tried to launch the app over 100 times, in different scenarios and I can't analyze an error pattern. The device crashlog says:
Process: DTMobileIS [34956]
Path: /Developer/Library/Daemons/DTMobileIS
Identifier: DTMobileIS
Version: ??? (???)
Code Type: ARM (Native)
Parent Process: lockbot [34938]
Date/Time: 2013-10-07 15:29:05.474 -0700
OS Version: iOS 6.1.3 (10B329)
Report Version: 104
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x00000000
Exception type EXC_BAD_ACCESS (SIGSEGV) indicates that an object which is getting accessed has been already released. A SIGSEGV is a segmentation fault, meaning you it is trying to access an invalid memory address. Reference: Exception Types in iOS crash logs
Instead of using the bundleIdentifier I also tried to specify the full app path or the full bundleIdentifier:
# with full app path
instruments \
-w c717fa22472d7b691ae5763af90e1e44244ad85a \
-t /Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/PlugIns/AutomationInstrument.bundle/Contents/Resources/Automation.tracetemplate \
-D "/Users/mj/Desktop/apps/trace" \
/Users/mj/Desktop/apps/LPSimpleExample-cal.app \
-e UIARESULTSPATH /Users/mj/Desktop/apps \
-e UIASCRIPT /Users/mj/Desktop/apps/_run_loop.js
# with full bundleIdentifier
instruments \
-w c717fa22472d7b691ae5763af90e1e44244ad85a \
-t /Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/PlugIns/AutomationInstrument.bundle/Contents/Resources/Automation.tracetemplate \
-D "/Users/mj/Desktop/apps/trace" \
/Users/mj/Desktop/apps/LPSimpleExample-cal.app \
-e UIARESULTSPATH /Users/mj/Desktop/apps \
-e UIASCRIPT /Users/mj/Desktop/apps/_run_loop.js
Configuration details
Instruments version: 5.0 (51166)
XCode version: 5.0 (5A1413)
Device Types: iPhone 5 - 6.1.3, iPhone 5C - 7.02, iPhone 5S - 7.0.2
Has anyone more information in which cases instruments can't launch an app on the device or when do you receive the error message unable to locate CFBundleIdentifier for path: LPSimpleExample-cal?
Are you using Calabash with Jenkins?
Has anyone more information in which cases instruments can't launch an app on the device or > when do you receive the error message unable to locate CFBundleIdentifier for path:
LPSimpleExample-cal?
I had the problem using Calabash on Jenkins and what helped me solve it was to launch instruments (calabash) in the app folder (where there is the xcodeproj.) Don't forget to copy the builded app in this folder.
please excuse me if I do not answer the question.
I had this problem when attempting to run an iOS app with instruments under the control of Xcode Server on the iDevice attached to the server host. That app, however, was never installed on the target iDevice before. I can only surmise that the error message
instruments ... unable to locate CFBundleIdentifier for path: ...
actually refers to the iDevice's file system (where that app is not present) in spite of the fact that the error message reports a path in the file system of the Xcode Server host. After I manually installed the app on the target device using my development machine once, the error message on the server host went away and instruments was working again.
My takeaway is that the error messages of Xcode Server (and/or instruments?) are just abysmally bad. Who needs enemies when you've got error messages like these?
Related
xcrun xcodebuild -version: 9.2
run_loop: 2.6.4
calabash-ios version: 0.20.5
iOS version: 11.2.6
Command- /Users/testmaskin/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/run_loop-2.6.4/lib/run_loop/device_agent/bin/iOSDeviceManager install /Users/testmaskin/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/run_loop-2.6.4/lib/run_loop/device_agent/ipa/DeviceAgent-Runner.app --device-id 61b08575d55927c0dd0b9192e37a2c1f421cd000
Output:
Terminating app due to uncaught exception 'CBXException',
reason: 'Unable to find appropriate codesign identity for device 61b08575d55927c0dd0b9192e37a2c1f421cd000 / app com.apple.test.DeviceAgent-Runner combo'
Output of tail -F ~/.calabash/iOSDeviceManager/logs/current.log
2018-03-20 16:46:04.676 INFO ShellRunner:70 | EXEC: /usr/bin/xcrun codesign -d --entitlements :- /Users/testmaskin/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/run_loop-2.6.4/lib/run_loop/device_agent/ipa/DeviceAgent-Runner.app
2018-03-20 16:46:05.171 INFO ShellRunner:70 | EXEC: /usr/bin/xcrun codesign -d --entitlements :- /Users/testmaskin/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/run_loop-2.6.4/lib/run_loop/device_agent/ipa/DeviceAgent-Runner.app
2018-03-20 16:46:05.258 INFO ShellRunner:70 | EXEC: /usr/bin/xcrun security find-identity -v -p codesigning
2018-03-20 16:46:05.466 ERROR ConsoleWriter:32 | No valid iOSDeveloperIdentities found on system.
However, the profile exists in the /Users/testmaskin/Library/MobileDevice/Provisioning Profiles directory as well as the device UDID exists in that profile. See the output below.
$ /usr/bin/xcrun security find-identity -v -p codesigning
1) 95CC7E649668236B68C7D309A07AAC5E3C9B409B "iPhone Distribution: Polly Lal (***********)"
1 valid identities found
Not sure what I'm missing here. I have a bunch of such test devices attached to their own Mac Mini hosts. Each of those setup are exhibiting this problem. So I'm sure its not because of a faulty device. Any help is appreciated.
I was using a distribution certificate. Someone pointed out that's not the right one. I generated a new developer certificate, regenerated the provisioning profile for that certificate and it worked!
The issue is fixed with recent update of Mac OSX.
I am using Xcode 8 on Mac Mini running OSX El Capitan (10.11.6). When I deploy my app on simultor is shows following error messages:
"launchd_sim quit unexpectedly"
"Unable to boot the iOS simulator"
How to resolve such type of issues?
Detailed exception report:
Process: launchd_sim [16545]
Path: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/sbin/launchd_sim
Identifier: launchd_sim
Version: 4.0.0 (972.1.5)
Code Type: X86-64 (Native)
Parent Process: ??? [1]
Responsible: launchd_sim [16545]
User ID: 501
Date/Time: 2016-10-25 13:53:29.247 +0530
OS Version: Mac OS X 10.11.6 (15G1004)
Report Version: 11
Anonymous UUID: 6844F1F8-F647-09F6-8FB0-A7B9C14F843B
Time Awake Since Boot: 17000 seconds
System Integrity Protection: enabled
Crashed Thread: 0
Dispatch queue: com.apple.main-thread
Exception Type: EXC_BAD_INSTRUCTION (SIGILL)
Exception Codes: 0x0000000000000001, 0x0000000000000000
Exception Note: EXC_CORPSE_NOTIFY
Application Specific Information: could not create temporary state directory
EDIT:
To check disk permissions:
sudo /usr/libexec/repair_packages --verify --standard-pkgs /
Output:
Permissions differ on "tmp", should be drwxrwxrwt , they are lrwxr-xr-x .
To repair disk permissions:
sudo /usr/libexec/repair_packages --repair --standard-pkgs --volume /
Output:
Permissions differ on "tmp", should be drwxrwxrwt , they are lrwxr-xr-x .
Unable to set owner & group on "tmp". Error 1: Operation not permitted
Unable to set permissions on "tmp". Error 1: Operation not permitted
This error indicates that launchd_sim is unable to create its temporary state directory (/private/tmp/com.apple.CoreSimulator.SimDevice....launchd_sim).
This can happen if /private/tmp is deleted or has changed permissions.
There have been a high volume of reports of this issue lately. The reason appears to be that the restricted bit is getting set on /private/tmp, which is why some users have reported that disabling SIP acts as a workaround for this issue.
The correct fix is to remove the restricted bit from that path. If you boot your system into recovery mode and launch Terminal, you should be able to do this with:
chflags norestricted /Volumes/.../private/tmp
or a larger hammer:
rm -rf /Volumes/.../private/tmp
mkdir /Volumes/.../private/tmp
chmod 1777 /Volumes/.../private/tmp
chown root:wheel /Volumes/.../private/tmp
These commands did the trick for me:
sudo chown root:admin /tmp; sudo chmod 1777 /tmp
sudo chown root:wheel /private/tmp; sudo chmod 1777 /private/tmp
$ sudo chmod 1777 /Volumes/Macintosh\ HD/private/tmp
worked for me.
The problem is, for some reason, your system has orphaned launch_sim processes.
The solution is to:
quit the simulator
open Activity Montior and search for sim.
manually Force Quit any launch_sim, ScriptAgent, or instruments processes.
I used the template from this website: http://blog.manbolo.com/2012/04/08/ios-automated-tests-with-uiautomation and created my own command line to run the automation test on terminal.
Here are some useful information about my script:
I'm using xCode 6.4.
I ran this automation script in Xcode instrument and it works fine.
Here is my command line:
instruments -w 927b666816e2d4377b208a872b42a1d3xxxxxxxx -t /Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/PlugIns/AutomationInstrument.xrplugin/Contents/Resources/Automation.tracetemplate ConsumeriOS -e UIASCRIPT/Users/wendywang/Documents/TIO/ConsumeriOS/ConsumeriOS/ConsumeriOSTests/automationScript/LogIn.js
But I received this error:
2015-10-05 14:16:34.122 instruments[23330:551118] WebKit Threading Violation - initial use of WebKit from a secondary thread. Instruments Usage Error : Failed to resolve target for Instrument 'Automation' instruments, version 6.4 (57082) usage: instruments [-t template] [-D document] [-l timeLimit] [-i #] [-w device] [[-p pid] | [application [-e variable value] [argument ...]]] tio-spare:~ wendywang$ ConsumeriOS -e UIASCRIPT /Users/wendywang/Documents/xxx/ConsumeriOS/ConsumeriOS/ConsumeriOSTests/automationScript/LogIn.js -bash: ConsumeriOS: command not found
I double checked that
The UDID is correct
The automation trace template is in the correct path
The LogIn.js file is in the correct path
One thing I am not sure:
The ConsumeriOS is the name of the code. But inside the code, it can actually produce a few apps. I am testing the app called Consumer. So I am not sure if I should write ConsumeriOS as the name of the app, or Consumer instead.
Does anyone know why it is generating this error? Thanks!
Huhu,
try this:
Give the
complete path to the app with the .app extension,
Put the DeviceID and the script into "",
try it with the device name, if it doesn't
work.
Here a sample that works for me.
instruments -w "DeviceID" -t PATHTOTEMPLATE/Automation.tracetemplate PATHTOAPP/ConsumeriOS.app -e UIASCRIPT "PATHTOSCRIPT/UITest.js"
Let me know!
The relevant message is this one:
tio-spare:~ wendywang$ ConsumeriOS -e UIASCRIPT /Users/wendywang/Documents/xxx/ConsumeriOS/ConsumeriOS/ConsumeriOSTests/automationScript/LogIn.js -bash: ConsumeriOS: command not found
It appears that you may have copy-pasted this command:
instruments -w 927b666816e2d4377b208a872b42a1d3xxxxxxxx -t /Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/PlugIns/AutomationInstrument.xrplugin/Contents/Resources/Automation.tracetemplate ConsumeriOS -e UIASCRIPT/Users/wendywang/Documents/TIO/ConsumeriOS/ConsumeriOS/ConsumeriOSTests/automationScript/LogIn.js
But incorrectly -- in two separate pieces, part 1:
instruments -w 927b666816e2d4377b208a872b42a1d3xxxxxxxx -t /Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/PlugIns/AutomationInstrument.xrplugin/Contents/Resources/Automation.tracetemplate
And part 2 (separated by a newline):
ConsumeriOS -e UIASCRIPT/Users/wendywang/Documents/TIO/ConsumeriOS/ConsumeriOS/ConsumeriOSTests/automationScript/LogIn.js
Separately, it looks like you wrote the name of your app (ConsumeriOS) instead of the full path to your app (/path/to/ConsumeriOS.app).
I am trying to learn how to debug iOS apps on my jailbroken iOS device using lldb.
I can't seem to figure out why lldb is not able to get functions when gdb is able to. For example, I am trying to find out what is the _mh_execute_header address.
On GDB
(gdb) info func _mh_ex*
All functions matching regular expression "_mh_ex*":
Non-debugging symbols:
0x000e5000 _mh_execute_header
On lldb
(lldb) image lookup -r -n _mh_e*
(lldb) image lookup -r -s _mh_e*
(lldb)
I did some searching around and found this site: http://versprite.com/og/ios-reverse-engineering-part-one-configuring-lldb/ and followed its instructions.
After executing the target create command:
(lldb) target create --arch arm Cood
Current executable set to '/Users/tester/Desktop/Cood' (armv7).
I can do this
(lldb) image lookup -r -n _mh_e*
(lldb) image lookup -r -s _mh_e*
1 symbols match the regular expression '_mh_e*' in /Users/tester/Desktop/Cood:
Address: Cood[0x00004000] (Cood.__TEXT + 0)
Summary: Cood`_mh_execute_header
But then I execute process continue and I get
(lldb) process continue
error: invalid process
I have no idea what is going on.
FYI, I executed the following commands on my Mac to connect to the iOS debug server (OS X Yosemite, Xcode 6.3.1, lldb-330.0.44)
(lldb) platform select remote-ios
(lldb) process connect connect://127.0.0.1:7777
(lldb) process attach -n Cood -w
Any help would be appreciated! Thank you.
I am using the following command in terminal to trigger my simulator.
instruments -w 'iPhone 5s' -t /Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/PlugIns/AutomationInstrument.xrplugin/Contents/Resources/Automation.tracetemplate <app file path> -e UIASCRIPT <script path> -e UIARESULTSPATH <testreport path>
For the first time it is working , but when i try to run it the second time in the same terminal window it is throwing the following errors.
Instruments Trace Error : Target failed to run: The operation couldn’t be completed. (FBSOpenApplicationErrorDomain error 8.) : Failed to launch process with bundle identifier "com.xxx.yyy"
and also soemtimes the error
Instruments Trace Error : Target failed to run: The operation couldn’t be completed. (FBSOpenApplicationErrorDomain error 4.)
Here is my code for running instruments using command line, note that this code is for real devices (TestAutomator is the name of the app, no need to add .ipa):
instruments -w 'fa10dec83c62a571a9691b5d9ef24cc68de73bf0' \
-t '/Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/PlugIns/AutomationInstrument.xrplugin/Contents/Resources/Automation.tracetemplate' \
TestAutomation \
-e UIASCRIPT '/Users/roykronenfeld/Desktop/Automation.js' \
-e UIARESULTSPATH '/Users/roykronenfeld/Desktop‘
And here is a working version for simulator:
instruments -t /Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/PlugIns/AutomationInstrument.bundle/Contents/Resources/Automation.tracetemplate "/Users/JOHN/Library/Application Support/iPhone Simulator/7.1/Applications/B9812A59-EBE4-454E-B910-B2969B4D3702/TestApp.app" -e UIASCRIPT ./Tests.js
I encountered this same error via an Appium run, which wraps Instruments.
For me, the fix was:
XCode > Projects > (My Project) > General
In the Identity section, I found errors with my ID and Certificate. I used Xcode prompts to fix both.
(Appium specific) Confirm node is installed.
Check the sign info of your project.Generally speaking, the warning message means that the Instrument didn't have the authority to run the target application on your device.