iOS开发-iPhone手机切换应用时屏幕下方为什么会出现应用提示-怎么实现应用提示-使用NSUserActivity的效果
iOS开发-iPhone手机切换应用时屏幕下方为什么会出现应用提示-怎么实现应用提示-使用NSUserActivity的效果-App Switcher Proactive Suggestion using handoff
很多人可能注意到了,在应用切换时屏幕底下出现的应用提示提示-而出现这种应用提示-使用了NSUserActivity-苹果文档是这样描述NSUserActivity的
An NSUserActivity object provides a lightweight way to capture the state of your app and put it to use later. You create user activity objects and use them to capture information about what the user was doing, such as viewing app content, editing a document, viewing a web page, or watching a video. When the system launches your app and an activity object is available, your app can use the information in that object to restore itself to an appropriate state. Spotlight also uses your user activity objects to improve search results for the user.
You create NSUserActivity objects at key moments and register them with the system. For example, you might create a user activity object when the user opens a web page, when your app moves to the background, or when the user performs some other significant task in your app. User activity objects are not intended as a way to track every task in your app, so you should not use them for small edits or other minor changes. Instead, use them for significant checkpoints that the user might want to continue later or on another device. You can also use them to provide better Spotlight search results.
https://developer.apple.com/documentation/foundation/nsuseractivity?language=objc
苹果官方视频
https://developer.apple.com/videos/play/wwdc2016/240/
并且可以设置-iOS主动建议到其他地方-比如:
键盘与QuickType建议,
地图和CarPlay,
应用切换器,
Siri互动,
锁屏
参考代码:
有一份Github的开源代码-用来参考
https://github.com/yudiz-solutions/YMProactiveSuggetions
当前页面是本站的「Google AMP」版。查看和发表评论请点击:完整版 »