Draft
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
这份代码实现了基础的 iOS Live Activity(iOS 17.2+)。
目前的逻辑是这样的:Widget 被系统唤醒进行 Refreshing 的时候(约 15-60min 唤醒一次)会判断距离下一节课还剩多久,如果是 0-30 分钟内,且先前没有唤醒过,则尝试启动 Live Activity。
但是调试过程中一直遇到 unsupportedTarget,查阅了一些资料,可以确定 Info.plist 等配置没有问题,唯一能解释的就是 Apple 禁止 Widget 自唤醒 LiveActivity(部分说明要求唤醒 LiveActivity 时 App 在前台)
鉴于后续重心不在这个项目上,我先提交这份在硬盘中的代码,留给后面的同学看看能不能完成。
另一个策略:参考这份 demo,利用 Expo Modules API 桥接 JS 和 Swift,实现 app 内调用 LiveActivity 唤醒。