diff --git a/Documentation/XcodeIntegrationGuide.md b/Documentation/XcodeIntegrationGuide.md index 245fcb03..688458dc 100644 --- a/Documentation/XcodeIntegrationGuide.md +++ b/Documentation/XcodeIntegrationGuide.md @@ -22,7 +22,7 @@ You'll need to perform the following steps for each target that you wish to inte ![Other Linker Flags](Resources/Integration_OtherLinkerFlags.png "Add the Other Linker Flags build setting") -5. Select the **Build Phases** tab and add a **New Run Script Phase**—name it “Profiler Framework Integration”. +5. Select the **Build Phases** tab and add a **New Run Script Phase**—name it “Profiler Framework Integration”. Make sure to **uncheck “Based on dependency analysis”** under “Run script”. ![New Run Script](Resources/Integration_NewBuildPhase.png "Add new run script and paste the script") @@ -56,44 +56,46 @@ You'll need to perform the following steps for each target that you wish to inte 6. Drag the “Profiler Framework Integration” script phase **above** the “Compile Sources” phase. - ![Drag to Top](Resources/Integration_DragToTop.png "Drag the new script to the top of the list") + ![Drag to Top](Resources/Integration_DragToTop.png "Drag the new script to the top of the list") -7. **iOS 14 requires an additional step.** Add a **New Run Script Phase**—name it “Profiler Framework Info.plist Integration”. Paste in the following shell script: +7. **iOS 14 requires an additional step.** Add a **New Run Script Phase**—name it “Profiler Framework Info.plist Integration”. Make sure to **uncheck “Based on dependency analysis”** under “Run script”. - ```bash - # Only integrate the framework for the Debug configuration by default. Edit this section to integrate with additional configurations. For example, to add the "Debug_Another" and "Release" configurations, set the following line to: - # ALLOWED_CONFIGURATIONS="Debug,Debug_Another,Release" - ALLOWED_CONFIGURATIONS="Debug" + Paste in the following shell script: - # Leave this section empty to dynamically determine the path of the Detox Instruments app. If you are seeing issues, point explicitly to the app here. - EXPLICIT_INSTRUMENTS_APP_PATH= - - if [ -z "$EXPLICIT_INSTRUMENTS_APP_PATH" ]; then - # Find where the Detox Instruments app is installed - INSTRUMENTS_APP_PATH=$(mdfind kMDItemCFBundleIdentifier="com.wix.DetoxInstruments" | head -n 1) - else - INSTRUMENTS_APP_PATH="$EXPLICIT_INSTRUMENTS_APP_PATH" - fi - PROFILER_BUILD_SCRIPT_PATH="${INSTRUMENTS_APP_PATH}/Contents/SharedSupport/Scripts/profiler_info_plist_phase.sh" - if [ "${INSTRUMENTS_APP_PATH}" -a -e "${PROFILER_BUILD_SCRIPT_PATH}" ]; then - echo Found integration script at "${PROFILER_BUILD_SCRIPT_PATH}" - # Run the Profiler framework integration script - "${PROFILER_BUILD_SCRIPT_PATH}" "${CONFIGURATION}" "${ALLOWED_CONFIGURATIONS}" - else - echo "Profiler not included: Cannot find an installed Detox Instruments app." - fi - ``` + ```bash + # Only integrate the framework for the Debug configuration by default. Edit this section to integrate with additional configurations. For example, to add the "Debug_Another" and "Release" configurations, set the following line to: + # ALLOWED_CONFIGURATIONS="Debug,Debug_Another,Release" + ALLOWED_CONFIGURATIONS="Debug" + + # Leave this section empty to dynamically determine the path of the Detox Instruments app. If you are seeing issues, point explicitly to the app here. + EXPLICIT_INSTRUMENTS_APP_PATH= - This script adds needed keys into app's Info.plist when building using the specified configurations. + if [ -z "$EXPLICIT_INSTRUMENTS_APP_PATH" ]; then + # Find where the Detox Instruments app is installed + INSTRUMENTS_APP_PATH=$(mdfind kMDItemCFBundleIdentifier="com.wix.DetoxInstruments" | head -n 1) + else + INSTRUMENTS_APP_PATH="$EXPLICIT_INSTRUMENTS_APP_PATH" + fi + PROFILER_BUILD_SCRIPT_PATH="${INSTRUMENTS_APP_PATH}/Contents/SharedSupport/Scripts/profiler_info_plist_phase.sh" + if [ "${INSTRUMENTS_APP_PATH}" -a -e "${PROFILER_BUILD_SCRIPT_PATH}" ]; then + echo Found integration script at "${PROFILER_BUILD_SCRIPT_PATH}" + # Run the Profiler framework integration script + "${PROFILER_BUILD_SCRIPT_PATH}" "${CONFIGURATION}" "${ALLOWED_CONFIGURATIONS}" + else + echo "Profiler not included: Cannot find an installed Detox Instruments app." + fi + ``` + + This script adds needed keys into app's Info.plist when building using the specified configurations. 8. Drag the “Profiler Framework Info.plist Integration” script phase **below** the “Copy Bundle Resources” phase. - ![Drag under Compile Sources](Resources/Integration_DragToBottom.png "Drag the new script under Compile Sources") + ![Drag under Compile Sources](Resources/Integration_DragToBottom.png "Drag the new script under Compile Sources") 9. In Xcode, build and run your application using a scheme that is set to use the **Debug** configuration. If you are running your application on a device, ensure that it is on the same Wi-Fi network as the Mac running Detox Instruments or the device is connected to the Mac with a USB cable. - If everything worked correctly, you should be able to see your application listed in Detox Instruments. Select your app to start profiling. + If everything worked correctly, you should be able to see your application listed in Detox Instruments. Select your app to start profiling. - ![Discovered](Resources/Integration_Discovered.png "Detox Instruments lists your app") + ![Discovered](Resources/Integration_Discovered.png "Detox Instruments lists your app") 10. Run your application again, this time using a scheme set to use the **Release** configuration. Verify that Detox Instruments cannot connect to your application. If you can still connect, make sure the Release configuration is not present under the **ALLOWED_CONFIGURATIONS** in the integration script (step 5).