ios - 将 watch 应用程序添加到 Flutter iOS 应用程序

我在尝试使用 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/

相关文章:

ios - Flutter 在我的 Flutter 应用程序的根目录上构建 IOS 不起作用

dart - 在 Flutter 中获取设备的宽度和高度

dart - 具有水平列表和网格的 Flutter 可滚动主体作为子项

android-studio - Android : Could not find aapt2-pr

dart - 检查无状态小部件是否在 flutter 中处理

flutter - 检测用户是否离开 Flutter 中的当前页面?

android - 在 Flutter 中剪切文本效果

dart - flutter 错误 : Could not find the correct Sco

flutter - Flutter 中的可滚动底部工作表

dart - 如何在没有 Scaffold.drawer 的情况下使用 Drawer?