Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS Quick Action Share with UIActivityViewController

Im struggling with iOS 3d touch / quick actions. I'm trying to implement a Quick Action Share button similar to Hangouts App using UIActivityViewController.

Following iOS dev guildes I have almost managed to achieve the goal but my application is starting with the splash & home screen right after performing the 3d touch click while the Hangouts app presents the UIActivityViewController without showing any viewcontroller beneath it.

- (void)handleShortcutItem:(UIApplicationShortcutItem *)item {
   NSString *string = @"Share String";
   NSURL *URL = [NSURL URLWithString:@"some URL"];

   UIActivityViewController *activityViewController = [[UIActivityViewController alloc] initWithActivityItems:@[string, URL] applicationActivities:nil];
   [self.window.rootViewController presentViewController:activityViewController animated:YES completion:nil];

Does anyone know how to launch those quick actions without launching the whole app?

like image 626
Shaar Avatar asked Dec 24 '22 02:12

Shaar


1 Answers

The shortcut item is added for each and every app downloaded from the App Store (at least on my device running iOS 10). There's no need for you to implement anything!

Note that TestFlight builds will have a "Send Feedback" shortcut option instead of "Share ___"

like image 64
Ilias Karim Avatar answered Jan 07 '23 07:01

Ilias Karim