Files
observer/flutter_app/README.md
T

1.6 KiB
Raw Blame History

observer

野生动物实时识别 AppFlutter 版)。Android / iOS 一套代码,后端接口与支付见 docs/PaymentApi.md

iOS 真机部署(iPhone

构建与安装

# 真机必须传 Mac 局域网 IP:默认 API_BASE_URL 是 10.0.2.2(仅 Android 模拟器可用),
# 不传则 iPhone 上所有网络请求(登录/授权/套餐)都会失败
flutter build ios --release --dart-define=API_BASE_URL=http://<Mac局域网IP>:8080

# 安装到真机(UDID 可用 `xcrun devicectl list devices` 查询)
xcrun devicectl device install app --device <UDID> build/ios/iphoneos/Runner.app

# 启动并抓控制台日志(--terminate-existing 先杀掉旧实例)
xcrun devicectl device process launch --console --terminate-existing \
  --device <UDID> com.observer.app

注意事项(踩过的坑)

  • debug 构建不能在真机上从桌面图标启动iOS 14+ 会提示 "In iOS 14+, debug mode Flutter apps can only be launched from Flutter tooling"。 debug 调试必须用 flutter run -d <设备ID> 或 Xcode IDE 启动(flutter devices 查设备ID); 从图标启动只对 release 构建有效。
  • 模型输入是 NHWCassets/model.tflite 做过字节级手术(开头 TRANSPOSE→RESHAPE 输入 [1,320,320,3]),改动记录见 git 历史,重导模型需同步处理,否则 iOS 报 "Node number 0 (TRANSPOSE) failed to prepare"。
  • 模拟器黑屏:本机 iOS 模拟器 Impeller 渲染黑屏,验证 UI 用 VM service flutter run 输出里的 DevTools 地址),或直接真机验证。