Search code examples
iosobjective-ciphoneswift3dtouch

3D touch in iOS


Could somebody share his/her best practice to handle different shortcutItems by parsing launchOptions

[launchOptions objectForKey:UIApplicationLaunchOptionsShortcutItemKey]. 

When you run the app by one of the Items - how to detect which exactly was tapped?

Thanks in advance.


Solution

  • You can use and get UIApplicationShortcutItem object.

    UIApplicationShortcutItem *shortcutItem = [launchOptions objectForKey:UIApplicationLaunchOptionsShortcutItemKey];
    NSDictionary *itemInfo = shortcutItem.userInfo;
    

    Once you have that you can check using shortcutItem.userInfo , it contains dictionary of info you provided while creating UIApplicationShortcutItem