求助:appium+IOS真机Desired Capabilities启动成功,app也打开了,但是Source一直在laoding转圈

问题

appium+IOS真机Desired Capabilities启动成功,但是Source一直在laoding转圈

环境

{
  "platformName": "iOS",
  "appium:platformVersion": "14.4",
  "appium:deviceName": "iPhone 12",
  "appium:automationName": "XCUITest",
  "appium:app": "com.yiyitech.powerEx",
  "appium:udid": "00008zzz-000E5D9111xxxxxx",
  "appium:xcodeSigningId": "173260@163.com"
}

之前安卓是正常的,可以启动

### 报错信息
appium日志报错:

[XCUITestDriver@76ca (123d4def)] Calling AppiumDriver.getScreenshot() with args: ["123d4def-d0b3-4609-83da-30577b5b3f73"]
[XCUITestDriver@76ca (123d4def)] Executing command 'getScreenshot'
[XCUITestDriver@76ca (123d4def)] Taking screenshot with WDA
[XCUITestDriver@76ca (123d4def)] Matched '/screenshot' to command name 'getScreenshot'
[XCUITestDriver@76ca (123d4def)] Proxying [GET /screenshot] to [GET http://127.0.0.1:8100/session/7F37389D-6B7B-478B-BEAD-484585ACC92F/screenshot] with no body
[XCUITestDriver@76ca (123d4def)] socket hang up
[XCUITestDriver@76ca (123d4def)] Error getting screenshot: An unknown server-side error occurred while processing the command. Original error: Could not proxy command to the remote server. Original error: socket hang up
[XCUITestDriver@76ca (123d4def)] Taking screenshot with WDA
[XCUITestDriver@76ca (123d4def)] Matched '/screenshot' to command name 'getScreenshot'
[XCUITestDriver@76ca (123d4def)] Proxying [GET /screenshot] to [GET http://127.0.0.1:8100/session/7F37389D-6B7B-478B-BEAD-484585ACC92F/screenshot] with no body
[iProxy@00008101:8100] Connection was refused to port 8100
[XCUITestDriver@76ca (123d4def)] socket hang up
[Xcode] xcodebuild exited with code '65' and signal 'null'
[XCUITestDriver@76ca (123d4def)] Taking screenshot with WDA
[XCUITestDriver@76ca (123d4def)] Matched '/screenshot' to command name 'getScreenshot'
[XCUITestDriver@76ca (123d4def)] Proxying [GET /screenshot] to [GET http://127.0.0.1:8100/session/7F37389D-6B7B-478B-BEAD-484585ACC92F/screenshot] with no body
[iProxy@00008101:8100] Connection was refused to port 8100
[XCUITestDriver@76ca (123d4def)] socket hang up
[XCUITestDriver@76ca (123d4def)] Encountered internal error running command: UnknownError: An unknown server-side error occurred while processing the command. Original error: Could not proxy command to the remote server. Original error: socket hang up
[XCUITestDriver@76ca (123d4def)]     at JWProxy.command (/Users/wangxiaochun/.appium/node_modules/appium-xcuitest-driver/node_modules/@appium/base-driver/lib/jsonwp-proxy/proxy.js:355:13)
[XCUITestDriver@76ca (123d4def)]     at runMicrotasks (<anonymous>)
[XCUITestDriver@76ca (123d4def)]     at processTicksAndRejections (internal/process/task_queues.js:95:5)
[XCUITestDriver@76ca (123d4def)]     at XCUITestDriver.proxyCommand (/Users/wangxiaochun/.appium/node_modules/appium-xcuitest-driver/lib/commands/proxy-helper.js:109:35)
[XCUITestDriver@76ca (123d4def)]     at getScreenshotFromWDA (/Users/wangxiaochun/.appium/node_modules/appium-xcuitest-driver/lib/commands/screenshots.js:12:20)
[XCUITestDriver@76ca (123d4def)]     at wrapped (/Users/wangxiaochun/.appium/node_modules/appium-xcuitest-driver/node_modules/asyncbox/lib/asyncbox.js:93:13)
[XCUITestDriver@76ca (123d4def)]     at retry (/Users/wangxiaochun/.appium/node_modules/appium-xcuitest-driver/node_modules/asyncbox/lib/asyncbox.js:66:13)
[XCUITestDriver@76ca (123d4def)]     at retryInterval (/Users/wangxiaochun/.appium/node_modules/appium-xcuitest-driver/node_modules/asyncbox/lib/asyncbox.js:103:10)
[XCUITestDriver@76ca (123d4def)]     at XCUITestDriver.getScreenshot (/Users/wangxiaochun/.appium/node_modules/appium-xcuitest-driver/lib/commands/screenshots.js:46:12)
[HTTP] <-- GET /session/123d4def-d0b3-4609-83da-30577b5b3f73/screenshot 500 1099 ms - 1450
[HTTP] 
[HTTP] --> GET /session/123d4def-d0b3-4609-83da-30577b5b3f73/window/rect
[HTTP] {}
[XCUITestDriver@76ca (123d4def)] Calling AppiumDriver.getWindowRect() with args: ["123d4def-d0b3-4609-83da-30577b5b3f73"]
[XCUITestDriver@76ca (123d4def)] Executing command 'getWindowRect'
[XCUITestDriver@76ca (123d4def)] Proxying [GET /window/size] to [GET http://127.0.0.1:8100/session/7F37389D-6B7B-478B-BEAD-484585ACC92F/window/size] with no body
[iProxy@00008101:8100] Connection was refused to port 8100
[XCUITestDriver@76ca (123d4def)] socket hang up
[XCUITestDriver@76ca (123d4def)] Encountered internal error running command: UnknownError: An unknown server-side error occurred while processing the command. Original error: Could not proxy command to the remote server. Original error: socket hang up
[XCUITestDriver@76ca (123d4def)]     at JWProxy.command (/Users/wangxiaochun/.appium/node_modules/appium-xcuitest-driver/node_modules/@appium/base-driver/lib/jsonwp-proxy/proxy.js:355:13)
[XCUITestDriver@76ca (123d4def)]     at runMicrotasks (<anonymous>)
[XCUITestDriver@76ca (123d4def)]     at processTicksAndRejections (internal/process/task_queues.js:95:5)
[XCUITestDriver@76ca (123d4def)]     at XCUITestDriver.proxyCommand (/Users/wangxiaochun/.appium/node_modules/appium-xcuitest-driver/lib/commands/proxy-helper.js:109:35)
[XCUITestDriver@76ca (123d4def)]     at XCUITestDriver.getWindowSizeNative (/Users/wangxiaochun/.appium/node_modules/appium-xcuitest-driver/lib/commands/general.js:278:12)
[XCUITestDriver@76ca (123d4def)]     at XCUITestDriver.getWindowSize (/Users/wangxiaochun/.appium/node_modules/appium-xcuitest-driver/lib/commands/general.js:52:14)
[XCUITestDriver@76ca (123d4def)]     at XCUITestDriver.getWindowRect (/Users/wangxiaochun/.appium/node_modules/appium-xcuitest-driver/lib/commands/general.js:121:29)
[HTTP] <-- GET /session/123d4def-d0b3-4609-83da-30577b5b3f73/window/rect 500 75 ms - 1208
[HTTP] 
[HTTP] --> GET /session/123d4def-d0b3-4609-83da-30577b5b3f73/source
[HTTP] {}
[XCUITestDriver@76ca (123d4def)] Calling AppiumDriver.getPageSource() with args: ["123d4def-d0b3-4609-83da-30577b5b3f73"]
[XCUITestDriver@76ca (123d4def)] Executing command 'getPageSource'
[XCUITestDriver@76ca (123d4def)] Matched '/source?format=xml&scope=AppiumAUT' to command name 'getPageSource'
[XCUITestDriver@76ca (123d4def)] Proxying [GET /source?format=xml&scope=AppiumAUT] to [GET http://127.0.0.1:8100/session/7F37389D-6B7B-478B-BEAD-484585ACC92F/source?format=xml&scope=AppiumAUT] with no body
[iProxy@00008101:8100] Connection was refused to port 8100
[XCUITestDriver@76ca (123d4def)] socket hang up
[XCUITestDriver@76ca (123d4def)] Encountered internal error running command: UnknownError: An unknown server-side error occurred while processing the command. Original error: Could not proxy command to the remote server. Original error: socket hang up
[XCUITestDriver@76ca (123d4def)]     at JWProxy.command (/Users/wangxiaochun/.appium/node_modules/appium-xcuitest-driver/node_modules/@appium/base-driver/lib/jsonwp-proxy/proxy.js:355:13)
[XCUITestDriver@76ca (123d4def)]     at runMicrotasks (<anonymous>)
[XCUITestDriver@76ca (123d4def)]     at processTicksAndRejections (internal/process/task_queues.js:95:5)
[XCUITestDriver@76ca (123d4def)]     at XCUITestDriver.proxyCommand (/Users/wangxiaochun/.appium/node_modules/appium-xcuitest-driver/lib/commands/proxy-helper.js:109:35)
[XCUITestDriver@76ca (123d4def)]     at XCUITestDriver.mobileGetSource (/Users/wangxiaochun/.appium/node_modules/appium-xcuitest-driver/lib/commands/source.js:50:35)
[XCUITestDriver@76ca (123d4def)]     at XCUITestDriver.getPageSource (/Users/wangxiaochun/.appium/node_modules/appium-xcuitest-driver/lib/commands/source.js:25:9)
[HTTP] <-- GET /session/123d4def-d0b3-4609-83da-30577b5b3f73/source 500 9 ms - 1066
[HTTP] 
[HTTP] --> GET /session/123d4def-d0b3-4609-83da-30577b5b3f73/timeouts
[HTTP] {}

提示之前Command+U执行Xcode正常的,但是了连接的时候报错了:


**2024-01-08 00:25:49.198469+0800 WebDriverAgentRunner-Runner[605:59822] Running tests...**

**Restarting after unexpected exit, crash, or test timeout in -[UITestingUITests testRunner]; summary will include totals from previous launches.**

**Test Suite 'Selected tests' started at 2024-01-08 00:25:49.588**

**Test Suite 'WebDriverAgentRunner.xctest' started at 2024-01-08 00:25:49.589**

**Test Suite 'UITestingUITests' started at 2024-01-08 00:25:49.589**

**t = nans Suite Set Up**

**2024-01-08 00:25:49.609044+0800 WebDriverAgentRunner-Runner[605:59822] [User Defaults] Couldn't write values for keys (**

**KeyboardAutocorrection**

**) in CFPrefsPlistSource<0x280427200> (Domain: com.apple.Preferences, User: kCFPreferencesCurrentUser, ByHost: No, Container: (null), Contents Need Refresh: No): setting preferences outside an application's container requires user-preference-write or file-write-data sandbox access**

**2024-01-08 00:25:49.616394+0800 WebDriverAgentRunner-Runner[605:59822] [User Defaults] Couldn't write values for keys (**

**KeyboardPrediction**

**) in CFPrefsPlistSource<0x280427200> (Domain: com.apple.Preferences, User: kCFPreferencesCurrentUser, ByHost: No, Container: (null), Contents Need Refresh: No): setting preferences outside an application's container requires user-preference-write or file-write-data sandbox access**

**2024-01-08 00:25:49.616972+0800 WebDriverAgentRunner-Runner[605:59822] [User Defaults] Couldn't write values for keys (**

**KeyboardShowPredictionBar**

**) in CFPrefsPlistSource<0x280427200> (Domain: com.apple.Preferences, User: kCFPreferencesCurrentUser, ByHost: No, Container: (null), Contents Need Refresh: No): setting preferences outside an application's container requires user-preference-write or file-write-data sandbox access**

**2024-01-08 00:25:49.617501+0800 WebDriverAgentRunner-Runner[605:59822] [User Defaults] Couldn't write values for keys (**

**DidShowGestureKeyboardIntroduction**

**) in CFPrefsPlistSource<0x280427200> (Domain: com.apple.Preferences, User: kCFPreferencesCurrentUser, ByHost: No, Container: (null), Contents Need Refresh: No): setting preferences outside an application's container requires user-preference-write or file-write-data sandbox access**

**Test Suite 'UITestingUITests' failed at 2024-01-08 00:25:49.622.**

**Executed 1 test, with 1 failure (0 unexpected) in 0.000 (0.033) seconds**

**Test Suite 'WebDriverAgentRunner.xctest' failed at 2024-01-08 00:25:49.622.**

**Executed 1 test, with 1 failure (0 unexpected) in 0.000 (0.033) seconds**

**Test Suite 'Selected tests' failed at 2024-01-08 00:25:49.623.**

**Executed 1 test, with 1 failure (0 unexpected) in 0.000 (0.034) seconds**

setting preferences outside an application’s container requires user-preference-write or file-write-data sandbox access**

看这行日志好像缺什么权限。帮忙看下

把xcodeSigningId的值设置成录播里老师写的iphone开发者试试呢?
“xcodeSigningId”: “iPhone Developer”

苹果手机的开发者选项打开了吗?