سؤال

In my app I am sharing some post to Google+. In this process, it is redirected to web page and shared.

My question is if the native Google+ app is installed in the device, is it possible to redirect to that app instead if web page?

Please find the piece of code here that I am using.

if ([[GPPSignIn sharedInstance] authentication]) {

    id<GPPShareBuilder> shareBuilder = [[GPPShare sharedInstance] shareDialog];
    [shareBuilder setURLToShare:[NSURL URLWithString:@"sample valid url"]];
    [shareBuilder setPrefillText:@"sample prefix text"];

    [shareBuilder open];
}

Thanks, Shashank

هل كانت مفيدة؟

المحلول

We just released a new version of the Google+ for iOS SDK (2-Oct-2013 v1.4.0) that now allows for your app to use native sharing so that your users do not need to leave your app to share content to Google+.

The following modifications to your code will enable the new in-app sharing experience:

if ([[GPPSignIn sharedInstance] authentication]) {

    id<GPPNativeShareBuilder> shareBuilder = [[GPPShare sharedInstance] nativeShareDialog];
    [shareBuilder setURLToShare:[NSURL URLWithString:@"sample valid url"]];
    [shareBuilder setPrefillText:@"sample prefix text"];

    [shareBuilder open];
}

For more information on this feature, see Sharing to Google+ from your iOS app.

This isn't exactly what you asked for, but I think its an even nicer experience!

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top