我对Google Plus iOS SDK有疑问。有没有办法分享照片和/或消息而不必使用GPPShareBuilder
?我需要创建一个自定义界面来执行此操作,并且无法找到任何功能或解决方案来创建简单的共享界面。
确定。我在开发者控制台中启用了Google Plus域API。并尝试通过Media:insert上传照片。这是一个代码:
NSError *error;
NSDictionary *body = @{ @"mediaURL" : photoURL.description };
NSData* jsonData = [NSJSONSerialization dataWithJSONObject:body options:NSJSONWritingPrettyPrinted error:&error];
NSURL *apiURL = [NSURL URLWithString:[NSString stringWithFormat:@"https://www.googleapis.com/upload/plusDomains/v1/people/me/media/cloud?access_token=%@", [self accessToken]]];
NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:apiURL];
request.HTTPMethod = @"POST";
request.HTTPBody = jsonData;
[request addValue:@"image/JPG" forHTTPHeaderField:@"Content-Type"];
NSOperationQueue *queue= [NSOperationQueue mainQueue];
[NSURLConnection sendAsynchronousRequest:request queue:queue completionHandler:^(NSURLResponse *response, NSData *data, NSError *connectionError)
{
NSString *responseString = [[NSString alloc] initWithData:data encoding:NSASCIIStringEncoding];
NSLog(@"%@", responseString);
}];
我一直得到下一个回复:
{
"error": {
"errors": [
{
"domain": "global",
"reason": "forbidden",
"message": "Forbidden"
}
],
"code": 403,
"message": "Forbidden"
}
}
我的代码有什么问题?