我正在使用Facebook图表API将图片和消息发布到Facebook。我从Raywenderlich教程中获得了帮助。在最近两周前它工作正常。但现在它给我造成了问题。我正在获取所有的Facebook个人资料信息。使用图表api发布图片到Facebook
UIImage *image = [UIImage imageNamed:@"no_image.png"];
data = UIImagePNGRepresentation(image);
NSURL *url = [NSURL URLWithString:@"https://graph.facebook.com/me/photos"];
NSString *message = [couponInfoDictionary objectForKey:@"offerTitle"];
message = [message stringByAppendingString:@"\n"];
NSString *offerSlogan = [couponInfoDictionary objectForKey:@"offerSlogan"];
message = [message stringByAppendingString:[NSString stringWithFormat:@"%@",offerSlogan]];
ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:url];
[request setData:data forKey:@"file"];
[request setPostValue:message forKey:@"message"];
[request setPostValue:_accessToken forKey:@"access_token"];
[request setDidFinishSelector:@selector(sendToPhotosFinished:)];
[request setDidFailSelector:@selector(requestError:)];
[request setDelegate:self];
[request startAsynchronous];
- (void)sendToPhotosFinished:(ASIHTTPRequest *)request
{
// Use when fetching text data
NSString *responseString = [request responseString];
NSLog(@"response string before photo id %@",responseString);
NSMutableDictionary *responseJSON = [responseString JSONValue];
NSString *photoId = [responseJSON objectForKey:@"id"];
NSLog(@"Photo id is: %@", photoId);
NSString *urlString = [NSString stringWithFormat:@"https://graph.facebook.com/%@?access_token=%@", photoId, [_accessToken stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
NSLog(@"sendToPhotosFinished = %@",urlString);
NSURL *url = [NSURL URLWithString:urlString];
ASIHTTPRequest *newRequest = [ASIHTTPRequest requestWithURL:url];
[newRequest setDidFinishSelector:@selector(getFacebookPhotoFinished:)];
[newRequest setDelegate:self];
[newRequest startAsynchronous];
}
但是,当我张贴的形象,它给了我错误
{"error":{"message":"Error validating application.","type":"OAuthException"}}
Photo id is: (null)
sendToPhotosFinished = https://graph.facebook.com/(null)?access_token=ABACesEZBKr3gBALqa4yE2QAnJbNbGvQKa9iCm53GmTwHQYoyaxqAqmdLj0gw9uWCbyhP5sV7N6uZBjaFDpD6v6G1C7GcZCjvcZBPqt7b1ZAxKtDvepN8c&expires_in=4778
Got Facebook Photo: {"error":{"message":"(#803) Some of the aliases you requested do not exist: (null)","type":"OAuthException"}}
我已经花了我三天时间解决它。但仍然没有任何想法..如何解决这个问题?
不,它不工作..我已通过我的身份证。 –
只是使用117795728310来表示“我”会起作用, –