我在尝试使用 watch 应用扩展创建 Flutter iOS 应用时遇到了一个问题。
为了测试,我简单地使用
创建了一个默认的 Flutter 应用程序flutter create watchapp
当它运行时,我得到了标准的演示 Flutter 应用程序。
如果我随后在 Xcode 中打开 ios/Runner.xcworkspace 项目并向项目中添加一个新目标(File->New->Target)并选择 watchOS->Watchkit App,它将生成 watch 应用。
我遇到的问题是再次运行应用程序(使用 flutter 运行)时出现以下错误。
Xcode build done. 1.2s
Failed to build iOS app
Error output from Xcode build:
↳
** BUILD FAILED **
Xcode's output:
↳
=== BUILD TARGET mywatch Extension OF PROJECT Runner WITH CONFIGURATION
Debug ===
target specifies product type 'com.apple.product-type.watchkit2-extension', but there's no such product type for the 'iphoneos' platform
我正在考虑构建一个与 Watch 应用程序通信的 Flutter 插件,但除非我可以让 Flutter 与添加的 watch 应用程序一起运行,否则没有什么意义。
有人有什么建议吗?
flutter :0.9.4, Xcode:10.0
更新:为了清楚起见,我将 WatchApp 作为 Runner 项目中的新目标添加为 Swift 应用程序,我不打算使用 Flutter/Dart 来创建 WatchApp。
最佳答案
Flutter 不支持 Apple Watch 应用,因为它缺乏对 iOS 的 Bitcode 支持,如 this GitHub issue 中所述。 .
您可以跟踪为 iOS 添加 Bitcode 支持的状态 - Flutter GitHub issue ,但目前它似乎对 Flutter 开发团队的优先级较低。
https://stackoverflow.com/questions/53048589/