Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flutter: Debug Run with iOS Device #252

Open
2 tasks done
hhstore opened this issue Mar 29, 2021 · 5 comments
Open
2 tasks done

Flutter: Debug Run with iOS Device #252

hhstore opened this issue Mar 29, 2021 · 5 comments

Comments

@hhstore
Copy link
Owner

hhstore commented Mar 29, 2021

related:

@hhstore
Copy link
Owner Author

hhstore commented Mar 29, 2021

flutter iOS 真机设备调试教程:

说明:

  • iPhone 真机调试, 编译速度, 明显比 Android 真机调试要快.
  • 注意 iOS14下, 要更新 xcode, 祖传坑爹.

先决条件:

  • iPhone 设备1台
  • apple cloud 个人账号(无需开发者账号)
  • 升级+ 安装最新的 xcode 版本
  • Android studio + flutter 开发环境配置好

FAQ:

ref:

@hhstore
Copy link
Owner Author

hhstore commented Mar 29, 2021

iphone 设置:

  • 编译通过, iPhone 出现 app 图标后, 点击, 报错如下:

image

image

  • 需要使用 flutter run 方式, 连接手机调试.

@hhstore hhstore changed the title Flutter: Run and Debug on iOS Device Flutter: Debug Run on iOS Device Mar 29, 2021
@hhstore hhstore changed the title Flutter: Debug Run on iOS Device Flutter: Debug Run with iOS Device Mar 29, 2021
@hhstore
Copy link
Owner Author

hhstore commented Apr 6, 2021

FAQ:

Q1. xcode 生成的签名私钥过期:

  • 重新生成:

image

  • 手动生成一个新的 签名私钥

image

  • 再次执行: flutter run, 连接 iOS 手机, 编译+运行+调试.

@hhstore
Copy link
Owner Author

hhstore commented May 12, 2021

Q2: 部分iOS 编译失败问题:

  • flutter 编译报错提示, 建议使用 xcode 打开工程, 编译一次.
  • 有些开源项目, 拿下来, 编译不通过, 可能是 iOS 的生成工程文件有问题.
  • 经常编译通过, iOS 手机打不开, 这种也不会输出报错信息. 其实有报错, 只是 flutter run 抓不到.
  • 要使用 xcode 编译, 在 xcode 的 console 里, 有明确的报错信息.
  • 所以, 对 xcode 的使用, 也要非常熟练. 这个是必须的.
  • 单纯 Android studio, 是不够的.

iOS常见原因:

  • iOS 等权限获取的配置缺失. info.plist 里, 添加 网络权限, 位置权限, 蓝牙权限等.
  • pod 文件等过老. 可以选择rm -rf iOS/, 然后 flutter create . 重新生成.
  • 然后根据 git diff, 简单比对, 保留旧的 asset 等 icon, 其他用新的, 就 OK.
  • 也可以 pod update 等操作. 这个操作有坑. 建议直接 删除, 重新生成 iOS 目录. 简单粗暴.

Android 常见原因:

  • Android 设备, 也有类似的权限获取设置. 同理.

@hhstore
Copy link
Owner Author

hhstore commented Nov 15, 2021

FAQ: 误报系列

  • 连接 iPhone, 编译报错.
  • 问题: 误报(说 xcode 版本低)
  • 实际上, 与此无关.

问题现象:

  • flutter 编译报错:
  • 编译+install 正常, run 出错.
Error launching app. Try launching from within Xcode via:
    open ios/Runner.xcworkspace

Your Xcode version may be too old for your iOS version.
  • clean + build, 依然报错.
  • 改成 xcode 编译, 编译通过, 依然是在运行阶段, 卡住. 新的报错:

image

Errors were encountered while preparing your device for development. 

Please check the Devices and Simulators Window.

解决办法:

解决办法: 重启 iPhone. 然后, 问题就真的解决了.

  • 阿西吧. 重启大法. 没有什么问题, 是重启解决不了的.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant