Reputation:
I've an iOS app with a Tab Bar Controller and five ViewControllers written in Objective-C. Now, I declared QuickActions in Info.plist file.
But cause I'm new at coding and there are only Swift codes to find in the internet I don't know how to do it.
Can anyone provide the code snippet for AppDelegate.m in Objective-C to open an specific ViewController?
Thank you for help!
Greetings, David.
Upvotes: 0
Views: 520
Reputation: 1158
if your application is launched fresh...then its launchOptions will contain shortcut item pressed which you can access using key UIApplicationLaunchOptionsShortcutItemKey.Find the type UIApplicationShortcutItem to perform action accordingly.
If your application is in background and your user selected shortcut item
- (void)application:(UIApplication *)application performActionForShortcutItem:(UIApplicationShortcutItem *)shortcutItem completionHandler:(void(^)(BOOL succeeded))completionHandler
will be called.As you can see you get pressed shortcut item directly you can get type of pressed item and perform action accordingly.Hope it helps :)
Edit You can check out https://github.com/dakeshi/3D_Touch_HomeQuickAction this will help you alot only difference is he has used dynamic quick actions.And one note about quick actions (both dynamic and static) is that unless you launch your app at least once quick options won't show up on 3D touch.
Upvotes: 2