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?
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 ___"
Related
I'm trying to present a sharing UIActivityViewController from a 3D touch menu action on the app icon on home screen, I'm doing the following :
- (void)application:(UIApplication *)application performActionForShortcutItem:(UIApplicationShortcutItem *)shortcutItem completionHandler:(void (^)(BOOL))completionHandler{
if([shortcutItem.type isEqualToString:#"share"]){
NSArray *arr = #[#"https://www.woshuo.pub"];
UIActivityViewController *vc = [[UIActivityViewController alloc]initWithActivityItems:arr applicationActivities:nil];
[self.window.rootViewController presentViewController:vc animated:YES completion:^{
}];
}
if (completionHandler) {
completionHandler(YES);
}
}
This results is the app being launched and the UIActivityViewController displayed. What I'm trying to do is to display the UIActivityViewController without launching the app.
I saw this behaviour in popular apps like Booking and AirBnB.
For example: the apple store APP
Are you talking about the Share action seen at the top of every App-Store-installed app's quick actions menu? (circled below)
That action is provided by the system, and always shares only a link to the App Store listing for the app. All other actions (the other four in the screenshot) are provided by the app itself (whether static or dynamic), and always launch the app when chosen.
Note that in iOS 10, if you app provides a Notification Center widget (aka Today view widget), that shows up along with the Quick Actions menu for your app on the Home screen -- if you're looking for a way to put more interactive content into your quick actions, that might be a viable route. (Note that tapping in the widget still launches your app, though.)
Well, the situation is when I am trying to share text in facebook with UIActivityViewController, the share text shows blank in the facebook popup whereas the URL provided comes but text doesn't show in Facebook share dialog or popup. One more thing sometimes the URL also don't come or show in share dialog.
NOTE:
Facebook native app is already installed in device and logged in from device settings, I have also updated the app to version 31.0.
Device used:- iPhone 6 with iOS 8.3
Code:-
NSString *shareString = [NSString stringWithFormat:#"Welcome to family."];
NSURL *website = [NSURL URLWithString:#"http://google.com"];
NSArray *shareArray = #[shareString,website];
UIActivityViewController *activityController = [[UIActivityViewController alloc]initWithActivityItems:shareArray
applicationActivities:nil];
[self presentViewController:activityController
animated:YES completion:nil];
[activityController setCompletionHandler:^(NSString *activityType, BOOL completed){
}];
This won't work if you have the newest Facebook app installed - the text always blank and sometimes URL doesn't show in facebook version 31.0 . This share feature only works older app means version less than 28..
iOS 7, Xcode 5
I've setup a UIActivityController in my app and no matter what I do, I can't ever see the icons for Twitter, Facebook, etc. I only see Mail and Message.
This happens both in the Simulator and on my iPhone 5S.
I've tried third-party tutorials and sample code and get the same behavior. However, when I use Safari/Yahoo on my iPhone, I can see everything, even though I do not have accounts for everything.
The code is straightforward:
NSString *text = #"How to add Facebook and Twitter sharing to an iOS app";
NSURL *url = [NSURL URLWithString:#"http://roadfiresoftware.com/2014/02/how-to-add-facebook-and-twitter-sharing-to-an-ios-app/"];
UIImage *image = [UIImage imageNamed:#"roadfire-icon-square-200"];
UIActivityViewController *controller =
[[UIActivityViewController alloc]
initWithActivityItems:#[text, url, image]
applicationActivities:nil];
[self presentViewController:controller animated:YES completion:nil];
My understanding is that I do NOT need to have active accounts on any device to simply see the icons in the Sheet.
So can someone help figure out why this is happening?
How does one share a video to Vimeo using the added support to the social framework on iOS 7?
This seems pretty new, haven't found any info on this.
This is what's called UIActivityViewController, available on iOS 6 and later. Based on initWithActivityItems it automatically decides what type of content you want to share and handles the rest. Pretty cool when used properly.
- (IBAction)showShareSheet:(id)sender {
NSArray *objects = #[moviePlayer.contentURL];
UIActivityViewController *activity = [[UIActivityViewController alloc]
initWithActivityItems:objects
applicationActivities:nil];
[self presentViewController:activity animated:YES completion:nil];
}
using uiactivity ,i can share content of my app to Facebook,twitter,email.
UIActivityViewController *activityController = [[UIActivityViewController alloc] initWithActivityItems:activityItems
applicationActivities:activities];
so i want to add my custom uiactivity,when user using UIActivityViewController at other app,my app can appear on the UIActivityViewController like Facebook,so it can share content to my app?
if apple allow me to do this,if yes,how to do?can you give some advice
edit: i think this is not repeat question。my question: i want to my app like Facebook,twitter can show at other developer app,if it used UIActivityViewController. if you cannot understand my question,you can ask me,i can give detail describe.sorry for my english