Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS Google Plus integration and sharing

I am trying to share content from my app to Google Plus. To this end, I have used the following code:

-(IBAction)handleGPlus{

    id<GPPShareBuilder> shareBuilder = [[GPPShare sharedInstance] shareDialog];

    [shareBuilder setURLToShare:[NSURL URLWithString:@"http://dummy.com"]];
    [shareBuilder setTitle:@"Some title" description:@"Some description" thumbnailURL:[NSURL URLWithString:@"http://dummy.com/image"]];
    [shareBuilder setContentDeepLinkID:kClientId];
    [shareBuilder open];
}

And I have set up the clientID like so:

static NSString * const kClientId = @"MY_CLIENT_ID";

But I get the following error:

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'You must specify |clientID| for |GPPSignIn|'
*** First throw call stack:
(0x346932a3 0x3c33897f 0x346931c5 0x1d2e33 0x122725 0x365860c5 0x36586077 0x36586055 0x3658590b  0x36585e01 0x364ae5f1 0x3649b801 0x3649b11b 0x3819e5a3 0x3819e1d3 0x34668173 0x34668117 0x34666f99 0x345d9ebd 0x345d9d49 0x3819d2eb 0x364ef301 0xee20d 0xed600)
libc++abi.dylib: terminate called throwing an exception

I have included the GoogleOpenSource.Framework and GooglePlus.Framework files too.

Any idea what I'm doing wrong?

like image 642
Rameez Hussain Avatar asked May 30 '13 10:05

Rameez Hussain


1 Answers

Because you are not assigning client_ id of GPPSignIn class. Try this code in your appdelegate

    [GPPSignIn sharedInstance].clientID = @"MY_CLIENT_ID";
    [GPPDeepLink setDelegate:self];
    [GPPDeepLink readDeepLinkAfterInstall];

then try sharing link for implementing it in right way.

I hope it helps you.

like image 155
chandan Avatar answered Oct 03 '22 00:10

chandan