Launching with UIApplicationShortcutItem

后端 未结 6 638
南旧
南旧 2021-01-31 17:38

I\'m implementing some 3D touch quick actions for my iOS 9 app in swift, and I have a curious issue. When my app is in the background and I launch with the quick action, everyth

6条回答
  •  情歌与酒
    2021-01-31 18:22

    XCode 11.6, Swift 5

    We can attach a process at runtime. XCode will wait until the process is started and will get attached to it when an App is launched manually.

    XCode -> Debug -> Attach to process by PID or Name -> ("Enter the name of an app in the pop-up")

    Directions:

    1. Make sure an application is freshly installed on a device or a simulator.
    2. Kill the application.
    3. In XCode attach the name of the process as mentioned above.
    4. Open the application through the desired shortcut

    P.S: If you are using SceneDelegate a shortcutItem can be found in

    func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
           switch connectionOptions.shortcutItem?.localizedTitle {
           case "Search":
           break
           case "DoSomething":
           break
           default:
           break
           } 
        }
    

    Happy Debugging :)

提交回复
热议问题