XcodeBuild of WebDriverAgent is working fine in Xcode but not Viz Appium Session

Hi Friends,

I am facing problem with the WebDriverAgent, that is when i try to run ‘xcodebuild’ code alone it does not throw any error and launches the application. But when the same xcodebuild was executed via an appium session, it throws
No profiles for ‘com.profile.name’ were found: Xcode couldn’t find a provisioning profile matching ‘com.profile.name’

I have tried reinstalling the entire setup several times with appium 1.6.3 and appium 1.6.1
Configurations:
MacOS - 10.11.6
iOs - 10.2.1
Appium (tried both 1.6.3 and 1.6.1)

Following the Appium Log

appium --address 192.168.1.117 --port 7850

[Appium] Welcome to Appium v1.6.1 (REV b8d80a6c2f2dff801bb2774d9b5cc8f864c2d15f)

[Appium] Non-default server args:

[Appium] address: ‘192.168.1.117’

[Appium] port: 7850

[Appium] Appium REST http interface listener started on 192.168.1.117:7850

[HTTP] → POST /wd/hub/session {“desiredCapabilities”:{“app”:“/Users/indium/Documents/Sabesan/Dream11/Dream11_Staging.ipa”,“newCommandTimeout”:“600”,“platformVersion”:“10.2”,“platformName”:“iOS”,“udid”:“64759eeb71e74f4f35e69bd901c7950d376d5bcd”,“deviceName”:“iPad Pro 2”}}

[debug] [MJSONWP] Calling AppiumDriver.createSession() with args: [{“app”:“/Users/indium/Documents/Sabesan/Dream11/Dream11_Staging.ipa”,“newCommandTimeout”:“600”,“platformVersion”:“10.2”,“platformName”:“iOS”,“udid”:“64759eeb71e74f4f35e69bd901c7950d376d5bcd”,“deviceName”:“iPad Pro 2”},null,null,null,null]

[Appium] Requested iOS support with version >= 10, using XCUITest driver instead of UIAutomation-based driver, since the latter is unsupported on iOS 10 and up.

[Appium] Creating new XCUITestDriver session

[Appium] Capabilities:

[Appium] app: ‘/Users/indium/Documents/Sabesan/Dream11/Dream11_Staging.ipa’

[Appium] newCommandTimeout: ‘600’

[Appium] platformVersion: ‘10.2’

[Appium] platformName: ‘iOS’

[Appium] udid: ‘64759eeb71e74f4f35e69bd901c7950d376d5bcd’

[Appium] deviceName: ‘iPad Pro 2’

[debug] [XCUITest] XCUITestDriver version: 2.2.0

[BaseDriver] Capability ‘newCommandTimeout’ changed from string (‘600’) to integer (600). This may cause unexpected behavior

[BaseDriver] Session created with session id: 7aa429df-5e36-4b99-990a-6c7cbf2dbc55

[debug] [XCUITest] Xcode version set to ‘8.2.1’

[debug] [XCUITest] iOS SDK Version set to ‘10.2’

[debug] [XCUITest] Available devices: 64759eeb71e74f4f35e69bd901c7950d376d5bcd

[debug] [XCUITest] Creating iDevice object with udid 64759eeb71e74f4f35e69bd901c7950d376d5bcd

[XCUITest] Determining device to run tests on: udid: ‘64759eeb71e74f4f35e69bd901c7950d376d5bcd’, real device: true

[BaseDriver] Using local app ‘/Users/indium/Documents/Sabesan/Dream11/Dream11_Staging.ipa’

[debug] [BaseDriver] Copying local zip to tmp dir

[debug] [BaseDriver] Unzipping /tmp/2017227-38998-11g2j9t.fq7p919k9/appium-app.zip

[debug] [BaseDriver] Testing zip archive: /tmp/2017227-38998-11g2j9t.fq7p919k9/appium-app.zip

[BaseDriver] Unzipped local app to ‘/tmp/2017227-38998-11g2j9t.fq7p919k9/Payload/Dream11 Staging.app’

[debug] [XCUITest] Checking whether app ‘/tmp/2017227-38998-11g2j9t.fq7p919k9/Payload/Dream11 Staging.app’ is actually present

[debug] [XCUITest] App is present

[debug] [ios-app-utils] Getting bundle ID from app ‘/tmp/2017227-38998-11g2j9t.fq7p919k9/Payload/Dream11 Staging.app’: ‘com.dream11.dream11app.staging’

[debug] [iOSLog] Attempting iOS device log capture via libimobiledevice idevicesyslog

[debug] [iOSLog] Found idevicesyslog: ‘/usr/local/bin/idevicesyslog’

[XCUITest] Setting up real device

[debug] [XCUITest] App is already installed.

[debug] [XCUITest] Full reset not requested. No need to install.

[XCUITest] Using WDA path: ‘/usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent’

[XCUITest] Using WDA agent: ‘/usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent/WebDriverAgent.xcodeproj’

[XCUITest] Launching WebDriverAgent on the device

[debug] [XCUITest] Carthage found: /usr/local/bin/carthage

[debug] [XCUITest] Killing hanging processes

[debug] [XCUITest] Using real device logger ‘idevicesyslog’

[debug] [XCUITest] Beginning test with command ‘xcodebuild build test -project /usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent/WebDriverAgent.xcodeproj -scheme WebDriverAgentRunner -destination id=64759eeb71e74f4f35e69bd901c7950d376d5bcd -configuration Debug’ in directory ‘/usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent’

[XCUITest] Waiting for WebDriverAgent to start on device

[debug] [XCUITest] Log file for xcodebuild test: /var/root/Library/Developer/Xcode/DerivedData/WebDriverAgent-brdadhpuduowllgivnnvuygpwhzy/Logs/Test/46F38587-3932-482D-AAAD-7B768E1B08D9/Session-WebDriverAgentRunner-2017-03-27_225224-NaO1KQ.log

[Xcode] 2017-03-27 22:52:26.753 xcodebuild[39030:200972] Error Domain=IDETestOperationsObserverErrorDomain Code=3 “Test operation was canceled. If you believe this error represents a bug, please attach the log file at /var/root/Library/Developer/Xcode/DerivedData/WebDriverAgent-brdadhpuduowllgivnnvuygpwhzy/Logs/Test/46F38587-3932-482D-AAAD-7B768E1B08D9/Session-WebDriverAgentRunner-2017-03-27_225224-NaO1KQ.log” UserInfo={NSLocalizedDescription=Test operation was canceled. If you believe this error represents a bug, please attach the log file at /var/root/Library/Developer/Xcode/DerivedData/WebDriverAgent-brdadhpuduowllgivnnvuygpwhzy/Logs/Test/46F38587-3932-482D-AAAD-7B768E1B08D9/Session-WebDriverAgentRunner-2017-03-27_225224-NaO1KQ.log}

[Xcode]

Testing failed:

No profiles for ‘com.facebook.WebDriverAgentRunners.Test’ were found: Xcode couldn’t find a provisioning profile matching ‘com.facebook.WebDriverAgentRunners.Test’.

Code signing is required for product type ‘UI Testing Bundle’ in SDK ‘iOS 10.2’

[Xcode] ** TEST FAILED **

The following build commands failed:

Check dependencies

(1 failure)

[XCUITest] xcodebuild exited with code ‘65’ and signal ‘null’

[debug] [XCUITest] xcodebuild failure warrants retry. Retrying…

[XCUITest] Shutting down sub-processes

[XCUITest] Shutting down Logger process (pid 39037)

[XCUITest] System log exited with code ‘0’

[debug] [XCUITest] Removing WDA application from device

[XCUITest] Launching WebDriverAgent on the device

[debug] [XCUITest] Carthage found: /usr/local/bin/carthage

[debug] [XCUITest] Killing hanging processes

[debug] [XCUITest] Using real device logger ‘idevicesyslog’

[debug] [XCUITest] Beginning test with command ‘xcodebuild build test -project /usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent/WebDriverAgent.xcodeproj -scheme WebDriverAgentRunner -destination id=64759eeb71e74f4f35e69bd901c7950d376d5bcd -configuration Debug’ in directory ‘/usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent’

[XCUITest] Waiting for WebDriverAgent to start on device

[debug] [XCUITest] Log file for xcodebuild test: /var/root/Library/Developer/Xcode/DerivedData/WebDriverAgent-brdadhpuduowllgivnnvuygpwhzy/Logs/Test/9E6F2D2C-E278-4A17-B7CC-95CF1D7A8FBB/Session-WebDriverAgentRunner-2017-03-27_225230-wIlq4X.log

[Xcode] 2017-03-27 22:52:33.652 xcodebuild[39300:201431] Error Domain=IDETestOperationsObserverErrorDomain Code=3 “Test operation was canceled. If you believe this error represents a bug, please attach the log file at /var/root/Library/Developer/Xcode/DerivedData/WebDriverAgent-brdadhpuduowllgivnnvuygpwhzy/Logs/Test/9E6F2D2C-E278-4A17-B7CC-95CF1D7A8FBB/Session-WebDriverAgentRunner-2017-03-27_225230-wIlq4X.log” UserInfo={NSLocalizedDescription=Test operation was canceled. If you believe this error represents a bug, please attach the log file at /var/root/Library/Developer/Xcode/DerivedData/WebDriverAgent-brdadhpuduowllgivnnvuygpwhzy/Logs/Test/9E6F2D2C-E278-4A17-B7CC-95CF1D7A8FBB/Session-WebDriverAgentRunner-2017-03-27_225230-wIlq4X.log}

[Xcode] 2017-03-27 22:52:33.653 xcodebuild[39300:201635] Connection peer refused channel request for “dtxproxy:XCTestManager_IDEInterface:XCTestManager_DaemonConnectionInterface”; channel canceled <DTXChannel: 0x7fbb894c1be0>

[Xcode]

Testing failed:

No profiles for ‘com.facebook.WebDriverAgentRunners.Test’ were found: Xcode couldn’t find a provisioning profile matching ‘com.facebook.WebDriverAgentRunners.Test’.

[Xcode] Code signing is required for product type ‘UI Testing Bundle’ in SDK ‘iOS 10.2’

** TEST FAILED **

The following build commands failed:

Check dependencies

(1 failure)

[XCUITest] xcodebuild exited with code ‘65’ and signal ‘null’

[XCUITest] Error: xcodebuild failed with code 65

at SubProcess.<anonymous> (../../lib/webdriveragent.js:332:25)
at emitTwo (events.js:106:13)
at SubProcess.emit (events.js:191:7)
at ChildProcess.<anonymous> (../../lib/teen_process.js:197:14)
at emitTwo (events.js:106:13)
at ChildProcess.emit (events.js:191:7)
at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12)

Error: xcodebuild failed with code 65

at SubProcess.<anonymous> (../../lib/webdriveragent.js:332:25)
at emitTwo (events.js:106:13)
at SubProcess.emit (events.js:191:7)
at ChildProcess.<anonymous> (../../lib/teen_process.js:197:14)
at emitTwo (events.js:106:13)
at ChildProcess.emit (events.js:191:7)
at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12)

[XCUITest] Shutting down sub-processes

[XCUITest] Shutting down Logger process (pid 39310)

[XCUITest] System log exited with code ‘0’

[debug] [XCUITest] Running ios real device reset flow

[debug] [XCUITest] Resetting simulator

[debug] [iOSLog] Stopping iOS log capture

(node:38998) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 4): Error: Can’t stop process; it’s not currently running

[MJSONWP] Encountered internal error running command: Error: xcodebuild failed with code 65

at SubProcess.<anonymous> (../../lib/webdriveragent.js:332:25)
at emitTwo (events.js:106:13)
at SubProcess.emit (events.js:191:7)
at ChildProcess.<anonymous> (../../lib/teen_process.js:197:14)
at emitTwo (events.js:106:13)
at ChildProcess.emit (events.js:191:7)
at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12)

[HTTP] ← POST /wd/hub/session 500 23840 ms - 167

Also the Capabilities

     capability.setCapability(MobileCapabilityType.PLATFORM_NAME, "iOS");
    					        capability.setCapability(MobileCapabilityType.PLATFORM_VERSION, "10.2");
    					        capability.setCapability(MobileCapabilityType.DEVICE_NAME, "iPad Pro 2");
    							capability.setCapability(MobileCapabilityType.UDID,"64759eeb71e74f4f35e69bd901c7950d376d5bcd");
    							capability.setCapability(MobileCapabilityType.APP, "/Users/indium/Documents/Sabesan/Dream11/Dream11_Staging.ipa");    							
capability.setCapability("xcodeConfigFile", "/usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent/xcodeConfigiOs.xcconfig");//The .xcodeconfig file created under  **iOS Xcode** Template type under New File
    							capability.setCapability("xcodeConfigFile", "/usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent/xcodeConfigMacOs.xcconfig");//The .xcodeconfig file created under **macOS** Xcode Template type under New File

I am facing this issue for quite a long time, so it would be great if any one help me PLS _/_

.