我正在使用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來表示「我」會起作用, –