iOS - 如何在 Xcode 12.1 中添加 "Today Extension" 目标?

iOS - How to add "Today Extension" target in Xcode 12.1?

我正在使用 Xcode 12.1 12A7403,当我转到 Editor > Add Target 时,使用 Storyboards 创建“今日扩展”的选项不再存在,而是有只是使用 SwiftUI 创建“Widget Extensions”的选项。

有没有办法在这个版本的 Xcode 中创建“今日扩展”?我仍然希望我的扩展与 iOS 13.

兼容

来自 Apple Systems Engineer of Apple's Developer Forum:

Today Extensions continue to be available, however, they are deprecated. When your app is submitted for the newer SDK the legacy today widget extension will be removed.

也就是说,最初为早期 iOS 版本设计的小部件仍然可以在设备上使用 - 只是容量更有限(应用程序在今日视图的底部)。根据 Apple:

Today widgets designed for iOS 13 and earlier aren’t available on the Home screen, but remain accessible at the bottom of the Today View and in the macOS Notification Center.

编辑:这意味着要创建 Today Extension,必须降级到 XCode 11,然后创建目标 Today Extension。

  1. 下载Xcode11
  2. 创建今日扩展
  3. 编码 Xcode12
  4. 发布到 App Store。

对我有用。