From 0d9fa81992467d6987e0c49cd1c874f6efe1fa19 Mon Sep 17 00:00:00 2001
From: zw <12345678>
Date: Thu, 4 Sep 2025 20:47:14 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dbug?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.idea/workspace.xml | 51 +++++++++++++++++++++++---------------------
Module/DeviceInfo.py | 8 ++++---
Module/Main.py | 3 +++
build.bat | 13 +++--------
4 files changed, 38 insertions(+), 37 deletions(-)
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index c487aa4..9c5b153 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -5,10 +5,9 @@
-
-
-
+
+
@@ -49,27 +48,27 @@
- {
+ "keyToString": {
+ "ASKED_ADD_EXTERNAL_FILES": "true",
+ "Python.123.executor": "Run",
+ "Python.Main.executor": "Run",
+ "Python.tidevice_entry.executor": "Run",
+ "RunOnceActivity.ShowReadmeOnStart": "true",
+ "SHARE_PROJECT_CONFIGURATION_FILES": "true",
+ "git-widget-placeholder": "main",
+ "javascript.nodejs.core.library.configured.version": "22.18.0",
+ "javascript.nodejs.core.library.typings.version": "22.18.0",
+ "last_opened_file_path": "F:/company code/AI item/20250820/iOSAI",
+ "node.js.detected.package.eslint": "true",
+ "node.js.detected.package.tslint": "true",
+ "node.js.selected.package.eslint": "(autodetect)",
+ "node.js.selected.package.tslint": "(autodetect)",
+ "nodejs_package_manager_path": "npm",
+ "settings.editor.selected.configurable": "com.gitee.ui.GiteeSettingsConfigurable",
+ "vue.rearranger.settings.migration": "true"
}
-}]]>
+}
@@ -151,6 +150,10 @@
+
+
+
+
@@ -175,7 +178,7 @@
-
+
diff --git a/Module/DeviceInfo.py b/Module/DeviceInfo.py
index 8232e56..2834562 100644
--- a/Module/DeviceInfo.py
+++ b/Module/DeviceInfo.py
@@ -10,7 +10,7 @@ import subprocess
from pathlib import Path
from typing import List, Dict, Optional
-from tidevice import Usbmux
+from tidevice import Usbmux, ConnectionType
from Entity.DeviceModel import DeviceModel
from Entity.Variables import WdaAppBundleId
from Module.FlaskSubprocessManager import FlaskSubprocessManager
@@ -110,13 +110,15 @@ class Deviceinfo(object):
continue
# 新接入设备
for device in lists:
- if (device not in self.deviceArray) and (len(self.deviceArray) < self.maxDeviceCount):
+ # usb设备,并且为新设备。并且大于总限制数量
+ if device.conn_type == ConnectionType.USB and (device not in self.deviceArray) and (len(self.deviceArray) < self.maxDeviceCount):
self.screenProxy += 1
try:
self.connectDevice(device.udid)
self.deviceArray.append(device)
except Exception as e:
LogManager.error(f"连接设备失败 {device.udid}: {e}", device.udid)
+
# 拔出设备处理
self._removeDisconnected(lists)
time.sleep(1)
@@ -126,9 +128,9 @@ class Deviceinfo(object):
# ----------------------------
def connectDevice(self, identifier: str):
# 1) 连接 WDA(USBClient -> 设备 8100)
-
try:
d = wda.USBClient(identifier, 8100)
+
LogManager.info("启动 WDA 成功", identifier)
except Exception as e:
LogManager.error(f"启动 WDA 失败,请检查手机是否已信任、WDA 是否正常。错误: {e}", identifier)
diff --git a/Module/Main.py b/Module/Main.py
index 837b0d1..c86317d 100644
--- a/Module/Main.py
+++ b/Module/Main.py
@@ -7,6 +7,7 @@ from Module.FlaskSubprocessManager import FlaskSubprocessManager
from Utils.DevDiskImageDeployer import DevDiskImageDeployer
from Utils.LogManager import LogManager
+
# 确定 exe 或 py 文件所在目录
BASE = Path(getattr(sys, 'frozen', False) and sys.executable or __file__).resolve().parent
LOG_DIR = BASE / "log"
@@ -25,8 +26,10 @@ if "--role=flask" in sys.argv:
_run_flask_role()
sys.exit(0)
+
# 项目入口
if __name__ == "__main__":
+
# 添加iOS开发包到电脑上
deployer = DevDiskImageDeployer(verbose=True)
deployer.deploy_all()
diff --git a/build.bat b/build.bat
index 2bdf314..98699cd 100644
--- a/build.bat
+++ b/build.bat
@@ -1,17 +1,11 @@
-@echo off
-python -m nuitka Module\Main.py ^
+python -m nuitka Module/Main.py ^
--standalone ^
--msvc=latest ^
--windows-console-mode=disable ^
--remove-output ^
--output-dir=out ^
--output-filename=IOSAI ^
- --include-package=Module,Utils,Entity,script,tidevice ^
- --include-module=tidevice.__main__ ^
- --include-module=tidevice._proto ^
- --include-module=tidevice._instruments ^
- --include-module=tidevice._usbmux ^
- --include-module=tidevice._wdaproxy ^
+ --include-package=Module,Utils,Entity,script ^
--include-module=flask ^
--include-module=flask_cors ^
--include-module=jinja2 ^
@@ -27,5 +21,4 @@ python -m nuitka Module\Main.py ^
--include-data-dir="E:/Code/python/iOSAI/SupportFiles=SupportFiles" ^
--include-data-dir="E:/Code/python/iOSAI/resources=resources" ^
--include-data-files="E:/Code/python/iOSAI/resources/iproxy/*=resources/iproxy/" ^
- --windows-icon-from-ico=resources/icon.ico
-pause
\ No newline at end of file
+ --windows-icon-from-ico=resources/icon.ico
\ No newline at end of file