1

直到昨天,我能够执行以下代码以在用户的​​ google+ 个人资料上共享,但今天突然在控制台日志中显示[GPPShareBuilderImpl getURL] |setURLToShare:| must be called for call-to-action to work.

代码 :

[GPPShare sharedInstance].delegate = self;

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

// This line will manually fill out the title, description, and thumbnail of the
// item you're sharing.
[shareBuilder setTitle:@"AppName"
           description:@"App description."
          thumbnailURL:[NSURL URLWithString:@"https://www.example.com/image.png"]];

/* This line passes the deepLinkID to our application
 if somebody opens the link on a supported mobile device */
[shareBuilder setContentDeepLinkID:@"post"];

// set the text of post. user can edit this before sharing.
[shareBuilder setPrefillText:@"I just created a trip from XYZ app."];

// This will create a call-to-action button with the specified label.
// - URL specifies where people will go if they click the button on a platform
// that doesn't support deep linking.
// - deepLinkID specifies the deep-link identifier that is passed to your native
// application on platforms that do support deep linking
[shareBuilder setCallToActionButtonWithLabel:@"Install"
                                         URL:[NSURL URLWithString:@"http://www.example.com/"]
                                  deepLinkID:@"install"];

[shareBuilder open];



根据Google+ 文档Share without URL部分),我可以使用以下方法而不是setURLToShare:. 这种方法直到昨天都运行良好。

[shareBuilder setTitle:@"title"
                 description:@"description";
                thumbnailURL:@"url"];

我在 Google+ 上没有找到与此相关的任何内容。我尝试删除应用程序并重新安装。知道该怎么做吗?

4

1 回答 1

0

无 URL 共享仅适用于基本共享,如果您想使用交互式帖子,则需要调用 setURLToShare。您可以在标头 GPPShare.h 中找到注释:

// Note: In order to set the call-to-action button:
// 1. User must have been authenticated with scopes including
//    "https://www.googleapis.com/auth/plus.login".
// 2. |setURLToShare:| must also be called.

很抱歉造成混淆,我们将更新文档以明确要求。谢谢!

于 2013-05-29T20:50:18.217 回答