iOS 应用程序扩展(小部件):打开 URL,然后在应用程序内执行一个方法
iOS App Extensions (Widgets): Open URL, and then execute a method within the app
在 iOS 应用扩展中,例如 the Today Widget, you can open the application when the widget is selected using NSExtensionContext。只有在通过小部件打开应用程序后,是否有任何方法可以在应用程序中执行方法(移动到不同的 UI 视图)?
您将必须创建一个自定义 URL 方案,您的应用将注册该方案并根据 URL 更改视图。
示例:myapp://action=showspecialview
然后您的应用将启动并可以解析 URL 并在检测到 URL 中的 showspecialview
时执行特殊行为。
在 iOS 应用扩展中,例如 the Today Widget, you can open the application when the widget is selected using NSExtensionContext。只有在通过小部件打开应用程序后,是否有任何方法可以在应用程序中执行方法(移动到不同的 UI 视图)?
您将必须创建一个自定义 URL 方案,您的应用将注册该方案并根据 URL 更改视图。
示例:myapp://action=showspecialview
然后您的应用将启动并可以解析 URL 并在检测到 URL 中的 showspecialview
时执行特殊行为。