Files
FruitServer/docs/plans/INBOX.md
T

24 lines
2.0 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
## [已处理] 2026-10-20 | K55-A iOS 加载失败定位:错误详情可见 + 重试前重新探测地址(仅 App 端)
**用户指令(2026-10-20,原文)**:
> 「现在iOS 启动还是剧目列表加载失败」
**现状**
- Mac 侧后端 `127.0.0.1:8081` 与 `39.162.50.99:8081` 均返回 200;Mac 局域网 IP 仍为 `192.168.31.187`;
- iOS 侧 `Info.plist` 已放开 ATS,`AppConfig` 探测顺序已改为 127 → 192.168.31.187 → 公网;
- 失败页现在只显示通用文案「剧目列表加载失败」,看不到实际请求地址与异常,无法继续定位。
**口径(只改 Flutter,不动后端、不改接口)**
1. 诊断信息可见(仅 `kDebugMode`):
- 首页/剧场失败页追加两行小字:「服务地址:{AppConfig.apiBaseUrl}」「错误:{error 原文}」(Key `catalog-debug-endpoint` / `catalog-debug-error`),12 号 `AppColors.subtle`,最多 2 行省略;
- `CatalogController.load/refresh` 失败时 `debugPrint('[catalog] base=... error=...')`;`AppConfig` 探测每个候选地址打印 `[probe] <url> -> ok/fail(<reason>)`。
2. 重试逻辑增强:首页与剧场错误态的「重试」按钮先 `await AppConfig.probeAndApplyBaseUrl()`,再 `catalog.load()`(Key 不变);避免首次启动网络未就绪/权限弹窗期间探测失败后一直用错地址。
3. App 回到前台(`AppLifecycleState.resumed`)时,若上次目录请求失败,自动重新探测并重载一次(不弹提示)。
4. 不改 release 行为(debug 信息仅在 kDebugMode 显示与打印)。
**测试/门禁**
- 单测:失败态 debug 行显示当前地址与错误;重试会先调用探测再 load;
- `dart analyze lib test` 零告警 + `flutter test` 全过 + `flutter build apk --debug`。
**流程**:从 `develop` 拉 `fix/ios-k55-diagnostics`;作者 `Zhou Weidong <502333560@qq.com>`;`--no-ff` 合回 develop 并 push;PROGRESS 留痕;iOS 复现由用户执行(重建后把失败页上的「服务地址 / 错误」两行发回来即可精确定位)。