Appium真机iOS环境启动WebDriverAgent失败,报错xcodebuild code 65
Hey there, let's work through this WebDriverAgent (WDA) launch failure you're facing on your iPhone SE (iOS 11.2.6) with Appium 1.8.0 and Xcode 9.3.1. That xcodebuild code 65 error plus the destination parameter misstep are common pain points with team signing setups, so let's break this down step by step.
1. Fix the "Destination" Parameter Error First
That "option ‘Destination’ requires at least one parameter of the form ‘key=value'" message means your manual xcodebuild command has an invalid format for the destination flag. Let's correct that first:
- Double-check your device's UDID: Grab it from Xcode via Window > Devices and Simulators, or run
idevice_id -l(you'll need libimobiledevice installed for this command). - Use the correct key-value format for the destination parameter, wrapped in quotes (critical because of the comma):
If you were skipping thexcodebuild -project WebDriverAgent.xcodeproj -scheme WebDriverAgentRunner -destination 'platform=iOS,id=YOUR_DEVICE_UDID' testplatform=iOS,part or missing quotes, that's exactly what's triggering the error.
2. Troubleshoot Xcodebuild Code 65 (Signing & Provisioning)
Code 65 is almost always tied to signing or provisioning issues—even with a team account, there are easy oversights:
- Validate WDA Target Signing Settings
Open the WebDriverAgent project (usually at/usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent/WebDriverAgent.xcodeproj). Check the signing configs for both targets:- WebDriverAgentRunner
- WebDriverAgentLib
For each, under Signing (Debug), select your team, and ensure "Provisioning Profile" is set to "Automatic" or a profile that includes your iPhone SE. Xcode sometimes glitches here, so manually selecting your team and waiting for it to refresh the profile can fix hidden mismatches.
- Trust the Developer Profile on Your Device
On your iPhone SE, go to Settings > General > Device Management (or "Profiles & Device Management"), find your team's developer profile, and tap "Trust [Your Team Name]". Without this, WDA can't install or run on the device. - Match Xcode Command Line Tools to Your Xcode Version
Since you're using Xcode 9.3.1, confirm the command line tools are pointing to the right version:
Runxcode-select -p—it should output something like/Applications/Xcode9.3.1.app/Contents/Developer. If not, switch it with:xcode-select -s /Applications/Xcode9.3.1.app/Contents/Developer
3. Refresh Appium's WDA Dependencies
You mentioned re-downloading dependencies, but let's do a clean refresh of WDA to rule out outdated or corrupted files:
# Navigate to the Appium XCUITest driver folder cd /usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver # Remove the old WDA folder rm -rf WebDriverAgent # Clone the latest compatible WDA version git clone https://github.com/appium/WebDriverAgent.git cd WebDriverAgent # Install required CocoaPods dependencies ./Scripts/bootstrap.sh
This ensures you're running a WDA version that plays nice with iOS 11.2.6 and Xcode 9.3.1.
4. Double-Check Your Appium Capabilities
Incorrect capabilities are a frequent culprit. Make sure yours include these critical, correctly formatted values:
{ "platformName": "iOS", "platformVersion": "11.2.6", "deviceName": "iPhone SE", "udid": "YOUR_DEVICE_UDID", "xcodeOrgId": "YOUR_TEAM_ID", // Grab this from Xcode > Preferences > Accounts > Your Team > View Details "xcodeSigningId": "iPhone Developer", // Use this exact value, not your team name "automationName": "XCUITest" }
A common mistake is filling xcodeSigningId with your team's actual name instead of the standard "iPhone Developer" identifier—this breaks the signing flow.
5. Test WDA Directly in Xcode
If all else fails, run WDA directly from Xcode to get clearer error details:
- Open WebDriverAgent.xcodeproj, select the WebDriverAgentRunner scheme, and pick your iPhone SE as the target device.
- Click the run button (play icon) and watch the Xcode console. Any signing errors, profile mismatches, or device connection issues will show up here with far more context than Appium's condensed logs.
If Xcode can't run WDA, fix that problem first before returning to Appium.
内容的提问来源于stack exchange,提问作者SilverF0x




