I want to add share on google-plus property in my application.
I registered client application on google web console and obtained client-id.
In my viewDidLoad function :
- (void)viewDidLoad{
CGRect rect = self.view.bounds;
rect.size.height = rect.size.height - 50;
_postContentUIWV = [[UIWebView alloc] initWithFrame:rect];
[_postContentUIWV loadHTMLString:selectedPostCD.content baseURL:nil];
[self.view addSubview:_postContentUIWV];
self.navigationController.navigationBar.tintColor = [UIColor whiteColor];
GPPSignIn *signIn = [GPPSignIn sharedInstance];
signIn.shouldFetchGooglePlusUser = YES;
// signIn.shouldFetchGoogleUserEmail = YES; // Uncomment to get the user's email
// You previously set kClientId in the "Initialize the Google+ client" step
signIn.clientID = kClientID;
[GPPSignIn sharedInstance].actions = [NSArray arrayWithObjects:
@"http://schemas.google.com/AddActivity",
@"http://schemas.google.com/BuyActivity",
@"http://schemas.google.com/CheckInActivity",
@"http://schemas.google.com/CommentActivity",
@"http://schemas.google.com/CreateActivity",
@"http://schemas.google.com/ListenActivity",
@"http://schemas.google.com/ReserveActivity",
@"http://schemas.google.com/ReviewActivity",
nil];
// Uncomment one of these two statements for the scope you chose in the previous step
signIn.scopes = @[ kGTLAuthScopePlusLogin ]; // "https://www.googleapis.com/auth/plus.login" scope
//signIn.scopes = @[ @"profile" ]; // "profile" scope
// Optional: declare signIn.actions, see "app activities"
signIn.delegate = self;
[signIn trySilentAuthentication];
}
Then in my onButtonCLick function:
- (void) googlePlusShareTapped {
id<GPPNativeShareBuilder> shareBuilder = [[GPPShare sharedInstance] nativeShareDialog];
[shareBuilder setURLToShare:[NSURL URLWithString:@"https://www.shinnxstudios.com"]];
[shareBuilder setPrefillText:@"This is an awesome G+ Sample to share"];
// [shareBuilder setTitle:@"Title" description:@"Descp" thumbnailURL:[NSURL URLWithString:@"https://www.fbo.com/imageurl"]];
[shareBuilder open];
}
However I get the message:
[lvl=3] -[GPPNativeShareBuilderImpl open] User must be signed in to use the native share box.
I downloaded google+ app from App Store and signed in. But every time I get this message and cannot share anything on google+.
Any suggestions?