Using a Personal Team Profile for Testing on Physical iOS Devices

If you have no membership in the Apple Developer Program, you can use a personal team profile to test an application on a physical iOS device:
  1. On the Mac, navigate to /Application/Silk/Mobile/common/Appium/node_modules/appium-xcuitestdriver/WebDriverAgent.
  2. Open WebDriverAgent.xcodeproj project in Xcode.
  3. From the TARGETS list, select the WebDriverAgentLib target:
    1. Click the General tab.
    2. Select Automatically manage signing.
    3. Select your development team.
    The Signing Certificate is automatically selected.
  4. From the TARGETS list, select the WebDriverAgentRunner target:
    1. Click the General tab.
    2. Select Automatically manage signing.
    3. Select your development team.
    The Signing Certificate is automatically selected.
  5. If Xcode fails to create a provisioning profile for the WebDriverAgentRunner target, manually change the bundle id for the target.
    1. Click the Build Settings tab.
    2. Change the Product Bundle Identifier to something that Xcode accepts. For example, if the Product Bundle Identifier is com.facebook.WebDriverAgentRunner, change it to io.appium.WebDriverAgentRunner or io.borland.WebDriverAgentRunner.
    3. Click the General tab.
    The target should now have a provisioning profile.
  6. Save the WebDriverAgent.xcodeproj project.
  7. To verify that everything works as expected, open a terminal and build the project:
    xcodebuild -project WebDriverAgent.xcodeproj -scheme WebDriverAgentRunner -destination 'id=<udid>' test IPHONEOS_DEPLOYMENT_TARGET=10.3
  8. To avoid problems during the reinstallation of the WebDriverAgent apps, permanently install an additional app that uses the same provisioning profile, on the device. For example, install the IntegrationApp of the WebDriverAgent Xcode project:
    1. From the TARGETS list, select the IntegrationApp target.
    2. Click the General tab.
    3. Select Automatically manage signing.
    4. Select your development team.
  9. If Xcode fails to create a provisioning profile for the IntegrationApp target, manually change the bundle id for the target in the same way as described above for the WebDriverAgentRunner target.
  10. After successfully configuring the IntegrationApp target, install and run the IntegrationApp on the physical iOS device:
    1. Select the target and the iOS device.
    2. Click Play.
Although the apps are successfully installed on the device, an error message like the following might appear in the console or the Appium log files:
2017-01-24 09:02:18.358 xcodebuild[30385:339674] Error
Domain=com.apple.platform.iphoneos
Code=-12 "Unable to launch com.apple.test.WebDriverAgentRunner-Runner"
UserInfo={NSLocalizedDescription=Unable to launch com.apple.test.WebDriverAgentRunner-Runner,
NSUnderlyingError=0x7fa839cadc60 {Error Domain=DTXMessage Code=1 "(null)"
UserInfo={DTXExceptionKey=The operation couldn't be completed. Unable to launch
com.apple.test.WebDriverAgentRunner-Runner because it has an invalid code signature,
inadequate entitlements or its profile has not been explicitly trusted by the user. :
Failed to launch process with bundle identifier 'com.apple.test.WebDriverAgentRunner-Runner'}}}
2017-01-24 09:02:18.358 xcodebuild[30385:339674] Error
Domain=IDETestOperationsObserverErrorDomain Code=5 "Early unexpected exit, operation
never finished bootstrapping - no restart will be attempted"
UserInfo={NSLocalizedDescription=Early unexpected exit,
operation never finished bootstrapping - no restart will be attempted}

Testing failed:
Test target WebDriverAgentRunner encountered an error (Early unexpected exit, operation never
finished bootstrapping - no restart will be attempted)
The problem is that the developer is not trusted on the device. If you manually try to run the apps on the device, you will see an Untrusted Developer message.

To solve this issue on the device, go to Settings > General > Profiles or Settings > General > Device Management, depending on the device type and the iOS version. Then trust the developer and allow the apps to be run.