3D Touch Home Shortcuts In Obj-C

前端 未结 5 806
一整个雨季
一整个雨季 2021-01-30 05:37

All of my apps are currently written in Obj-C. The link https://developer.apple.com/library/content/samplecode/ApplicationShortcuts/Introduction/Intro.html#//apple_ref/doc/uid/

5条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-01-30 06:09

    It works on both swift 3 and 4 (only on home screen shortcuts)

    //Add plist items as show in image and write following method in Appdelegate
    //3D Touch Method shortcuts from home screen
    
    func application(_ application: UIApplication, performActionFor shortcutItem:UIApplicationShortcutItem, completionHandler: @escaping (Bool) -> Void) {
    
    if shortcutItem.type == "Share" {
        //handle action Share
        let alert = UIAlertController(title: "3D touch Share", message: "Yahoo!!! 3D touch is working

提交回复
热议问题