Please note, I'm looking for /Applications/Xcode.app/Contents/Developer/usr/bin/instruments util (lower-case), not the Instruments app which can be found in Xcode.app/Contents/Applications.
I have both Xcode12 and Xcode13-beta-5 on my computer.
When run xcrun instruments -w <device id>, Xcode13 says xcrun: error: Failed to locate 'instruments'.
Locating the "instruments" in Xcode12:
olia#Olhas-MacBook-Pro % ls /Applications/Xcode.app/Contents/Developer/usr/bin/*instruments*
# output ✅
/Applications/Xcode.app/Contents/Developer/usr/bin/instruments
Locating the "instruments" in Xcode13:
olia#Olhas-MacBook-Pro % ls /Applications/Xcode-beta.app/Contents/Developer/usr/bin/*instruments*
# output ❌
zsh: no matches found: /Applications/Xcode-beta.app/Contents/Developer/usr/bin/*instruments*
Here, Xcode-beta.app is Xcode13, and Xcode.app is Xcode12.
There's no "instruments" util because it was deprecated in Xcode12, and in Xcode13 it seems to be removed.
Apple recommends using xcrun xctrace instead of xcrun instruments in Xcode12.
But as command xcrun instruments -w is for pre-launching Simulator, xctrace doesn't apply there.
We can run smth like
open -a Simulator.app --args -CurrentDeviceUDID <device id>
haha ~, I copied Xcode 's instruments to Xcode13 's /Applications/Xcode.app/Contents/Developer/usr/bin/ , then run react-native run-ios successful.
For me I needed to upgrade react-native using:
yarn upgrade react-native
Related
I submitted a new version of my app to AppStore and it got rejected due to some crashes that I never experienced while testing the app.
Unfortunately I can't seem to be able to reproduce the issue so all I have to analyze the 2 unsymbolicated crash logs (.txt files) they sent me.
However, I am having problems symbolicating them.
Crash Log 1
Crash Log 2
I tried following the steps provided HERE and HERE, as well as other suggestions but no luck.
Here are the things I tried so far:
$ atos -arch arm64 -o Qlear.app.dSYM/Contents/Resources/DWARF/Qlear -l 0x1839fa000 0x0000000183a1c2e8
Unfortunately the command returns only 0x00000001000222e8 (in Qlear)
$ atos -arch arm64 -o 'Qlear.app'/'Qlear' 0x1839fa000
$ atos -arch arm64 -o 'Qlear.app.dSYM/Contents/Resources/DWARF/Qlear' 0x1839fa000
Both commands return 0x1839fa000
$ dwarfdump --uuid Qlear.app.dSYM
$ dwarfdump --uuid Qlear.app.dSYM/Contents/Resources/DWARF/Qlear
Both commands return
UUID: 4FFCBD15-01BA-366A-8C28-E4E613401616 (armv7) Qlear.app.dSYM/Contents/Resources/DWARF/Qlear
UUID: 97BD48FC-11E3-37C9-A081-700DCE0CDB23 (arm64) Qlear.app.dSYM/Contents/Resources/DWARF/Qlear
If I try $ dwarfdump --lookup 0x1839fa000 -arch arm64 Qlear.app.dSYM I get:
----------------------------------------------------------------------
File: Qlear.app.dSYM/Contents/Resources/DWARF/Qlear (arm64)
----------------------------------------------------------------------
Looking up address: 0x00000001839fa000 in .debug_info... not found.
Looking up address: 0x00000001839fa000 in .debug_frame... not found.
So in the end I thought the .dSYM files(I tried the one on my Mac as well as the one from iTunes Connect) are corrupted so I tried dwarfdump --all Qlear.app.dSYM but this seems to be working as it returns a lot of content.
Any ideas what I'm doing wrong here? Am I mixing up the commands, am I using the wrong hex?
Finally, after hours of searching I finally found a solution:
Change the crash logs extension from .txt to .crash.. This is very important since .txt files are not recognized. I was also unable to find any info on this while reading Apple documentation.
Connect an iOS device and start Xcode.
In Xcode, go to Windows > Devices and Simulators (Shift + CMD + 1)
Select the Devices tab and then View Devices Logs.
In the left pane, select This Device and then drag-n-drop the .crash files inside.
Wait for the files to load and get symbolicated. The logs can also be symbolicated manually after drag-n-drop: Right Click on the log > Re-Symbolicate Log.
I've successfully installed Qt 5.7.0 and Qt-creator 4.1.0 on El Capitan with Xcode 8.
I fixed the xcode sdk-version errors from qt, and now I'm trying to build one of the examples for iphonesimulator. None of them work. All of them fail with error message of type:
The following build commands failed:
CopyPNGFile Debug-iphonesimulator/2dpainting.app/Default-568h#2x.png 2dpainting.xcodeproj/Default-568h#2x.png
I can confirm that directory Debug-iphonesimulator/2dpainting.app does not have the png-file, it's actually located somewhere within the qt installation directories. Copying the png to the source folder does not help as the folder gets overwritten upon running 'make'.
Any advice would be appreciated.
Edit:
The build kit warns about the following issue:
"Device type is not supported by the Qt version". Device type is 'iOS simulator'.
I had the same problem after I had updated my Xcode to version 8.0.
My first error was "Project ERROR: Xcode not set up properly. You may need to confirm the license agreement by running /usr/bin/xcodebuild."
To solve this problem, I created a symbolic link:
cd /Applications/Xcode.app/Contents/Developer/usr/bin/
sudo ln -s xcodebuild xcrun
Then I got error "Project ERROR: Current iphonesimulator SDK version (10.0) is too old. Please upgrade Xcode."
I commented two strings out in file QT_DIR/5.7/ios/mkspecs/macx-ios-clang/features/sdk.prf
lessThan(QMAKE_MAC_SDK_VERSION, "8.0"): \
error("Current $$QMAKE_MAC_SDK SDK version ($$QMAKE_MAC_SDK_VERSION) is too old. Please upgrade Xcode.")
Then I got error about emulator. Qt could not find it. I replaced line of code in file QT_DIR/5.7/ios/mkspecs/macx-ios-clang/xcodebuild.mk from:
IPHONESIMULATOR_GENERIC_DESTINATION := "id=$(shell xcrun simctl list devices | grep -E 'iPhone|iPad' | grep -v unavailable | perl -lne 'print $$1 if /((.*?))/' | tail -n 1)"
to:
IPHONESIMULATOR_GENERIC_DESTINATION := "id=$(shell xcrun simctl list devices | grep -E 'iPhone|iPad' | grep -v unavailable | awk 'match ($$0, /\(([A-F0-9\-]*\))/ ) { print substr ($$0, RSTART+1, RLENGTH-2) }' | tail -n 1)"
And finally afer all of it I got error "The following build commands failed:
CopyPNGFile Debug-iphonesimulator/Test01.app/Default-568h#2x.png Test01.xcodeproj/Default-568h#2x.png"
This error occurred due to the fact that the system has two file xcrun. And script /Applications/Xcode.app/Contents/Developer/usr/bin/copypng starts one, which is a symbolic link. Then I changed path in this script
from:
my $PNGCRUSH = `xcrun -f pngcrush`;
to:
my $PNGCRUSH = `/usr/bin/xcrun -f pngcrush`;
And then I finally had built the project without errors and opened it in Xcode.
I had this stupid error and spent two days to nail down. I was about to downgrade Xcode and thought lets try one more time. Finally nailed down.
Symptom:
The simplest project wont build from Qt Creator. The error I would get: CopyPNG failed or something along the line and a hint '-f' unknown parameter.
Reason: xcrun takes both -f and -find from the terminal I can see, but it does not like -f from the script copypng. (copypng is a perl script by the way.)
The solution: Open the file /Applications/Xcode.app/Contents/Developer/usr/bin/copypng and find
my $PNGCRUSH = `xcrun -f pngcrush`;
changed to
my $PNGCRUSH = `xcrun -find pngcrush`;
PS: I dint have path problem with xcrun, if you have it'd be good to put the whole path as advised above.
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.
I have problem with using Export function in Xcode ("Your account already have distribution certificate") so I used solution with xcodebuild. It produce IPA file but I see this in console:
### Checking original app
+ /usr/bin/codesign --verify -vvvv /.../My.app
Program /usr/bin/codesign returned 1 : [/.../My.app: resource envelope is obsolete
]
Codesign check fails : /.../My.app: resource envelope is obsolete
Is it a problem from my side and how to solve it?
If you are using Mac OSX 10.9.5 or later, then there is an issue with OS codesigning with V2 signature.
So, use --no-strict flag with codesign --verify to getover this error.
If you're using PackageApplication to create an .ipa file, then
Edit the PackageApplication perl script tool using vi PackageApplication command and update codesign function occurrences to pass "--no-strict" parameter.
Example:
my $result = runCmd("/usr/bin/codesign", "--verify", "--no-strict",
"-vvvv", , $plugin );
I was facing same and got following response from Apple Dev Team. The issue is resolved for me.
The command line tool “codesign” has changed in 10.9.5 and 10.10, you need to pass “--no-strict” option to the command, (the problem has been reported and will be fixed).
To workaround the problem, please save a copy and modify PackageApplication to pass “—no-strict” to codesign, you can locate PackageApplication by running the following:-
xcrun -sdk iphoneos -f PackageApplication
I would like to use the included ./emulator command with Cordova/PhoneGap to run my app in the iPad simulator from the command line.
The basic instructions are here:
http://docs.phonegap.com/en/2.2.0/guide_command-line_index.md.html
I've installed the iOS simulator from here:
https://github.com/phonegap/ios-sim
The documentation says it supports simulating an iPad from the command line. However, it opens by default to iPhone and changing the device to "iPad" closes the app (and it is not installed on the home screen). I've searched but can't find documentation to launch to simulate an iPad.
How do I run the Cordova ./emulator command to open to iPad?
It may be that you were using an old version of phonegap/cordova, but in version 3.4 the following works for me:
cordova emulate ios --target="iPad"
The Cordova emulate script is just a wrapper for the ios-sim command which you can use directly from the command line. Assuming your current working directory is the one with the emulate script in it, you can launch your build in the emulator in iPad mode with the following:
ios-sim launch ../build/myApp.app --family ipad --stderr console.log --stdout console.log &
The following is undoubtedly naive (I don't know shell-scripting), but I've hacked the emulate script to support a second command-line parameter which allows me to specify the device family. You might not be aware that the script already accepts a first parameter which allows you to specify the path to your project's .app file as it figures out the path if the parameter is not specified.
Update your version of the script with the following (GitHub fork here):
#! /bin/sh
#
# Licensing info removed for brevity
#
set -e
XCODE_VER=$(xcodebuild -version | head -n 1 | sed -e 's/Xcode //')
XCODE_MIN_VERSION="4.5"
if [[ "$XCODE_VER" < "$XCODE_MIN_VERSION" ]]; then
echo "Cordova can only run in Xcode version $XCODE_MIN_VERSION or greater."
exit 1
fi
CORDOVA_PATH=$( cd "$( dirname "$0" )" && pwd -P)
PROJECT_PATH="$(dirname "$CORDOVA_PATH")"
XCODEPROJ=$( ls "$PROJECT_PATH" | grep .xcodeproj )
PROJECT_NAME=$(basename "$XCODEPROJ" .xcodeproj)
APP_PATH=$1
DEVICE_FAMILY=$2
if [ $# -lt 1 ]; then
APP_PATH="$PROJECT_PATH/build/$PROJECT_NAME.app"
DEVICE_FAMILY=iphone
fi
if [ ! -d "$APP_PATH" ]; then
echo "Project '$APP_PATH' is not built. Building."
$CORDOVA_PATH/build || exit $?
fi
if [ ! -d "$APP_PATH" ]; then
echo "$APP_PATH not found to emulate."
exit 1
fi
# launch using ios-sim
if which ios-sim >/dev/null; then
ios-sim launch "$APP_PATH" --family "$DEVICE_FAMILY" --stderr "$CORDOVA_PATH/console.log" --stdout "$CORDOVA_PATH/console.log" &
else
echo -e '\033[31mError: ios-sim was not found. Please download, build and install version 1.4 or greater from https://github.com/phonegap/ios-sim into your path. Or "brew install ios-sim" using homebrew: http://mxcl.github.com/homebrew/\033[m'; exit 1;
fi
You can then run the script like this (assumes your present working directory is the cordova directory containing the scripts):
./emulate ../build/myApp.app ipad
If you're always going to test on the iPad and you prefer not to have to specify the path to your app every time, you could just hardcode your preferred device family into the script like so and launch the emulator as you have been doing previously:
ios-sim launch "$APP_PATH" --family ipad --stderr "$CORDOVA_PATH/console.log" --stdout "$CORDOVA_PATH/console.log" &
For me all the mentioned options here did not work, I had to call it with this command to show the iPad Retina:
``ios-sim launch [DIR_OF_APP]platforms/ios/build/emulator/My-App.app --devicetypeid "com.apple.CoreSimulator.SimDeviceType.iPad-Retina, 8.2"
To retrieve all the devicetypeid's type ios-sim showdevicetypes