必须调用“setURLToShare”才能使号召性用语发挥作用

时间:2013-05-28 06:20:53

标签: ios objective-c ios6 google-plus

直到昨天我才能执行以下代码来分享用户的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+ documentationShare without URL部分),我可以使用以下方法代替setURLToShare:。这种方法到昨天一直很好。

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

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

1 个答案:

答案 0 :(得分: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.

很抱歉,我们会更新文档以明确要求。谢谢!