如何使用新的API/SDK從iOS應用程序上傳照片到Facebook?我已經試過了,我沒有得到任何地方,只是繼續在圈子裏跑。下面是代碼我目前有:使用新的iOS Facebook SDK API上傳照片(3.0)
-(void)dataForFaceboo{
self.postParams =
[[NSMutableDictionary alloc] initWithObjectsAndKeys:
self.uploadPhoto.image, @"picture", nil];
}
-(void)uploadToFacebook{
[self dataForFacebook];
NSLog(@"Going to facebook: %@", self.postParams);
// Hide keyboard if showing when button clicked
if ([self.photoCaption isFirstResponder]) {
[self.photoCaption resignFirstResponder];
}
// Add user message parameter if user filled it in
if (![self.photoCaption.text
isEqualToString:kPlaceholderPostMessage] &&
![self.photoCaption.text isEqualToString:@""])
{
[self.postParams setObject:self.photoCaption.text forKey:@"message"];
}
[FBRequestConnection startWithGraphPath:@"me/feed"
parameters:self.postParams
HTTPMethod:@"POST"
completionHandler:^(FBRequestConnection *connection,
id result,
NSError *error)
{
NSString *alertText;
if (error) {
alertText = [NSString stringWithFormat:
@"error: domain = %@, code = %d",
error.domain, error.code];
} else {
alertText = [NSString stringWithFormat:
@"Posted action, id: %@",
[result objectForKey:@"id"]];
}
// Show the result in an alert
[[[UIAlertView alloc] initWithTitle:@"Result"
message:alertText
delegate:self
cancelButtonTitle:@"OK!"
otherButtonTitles:nil] show];
}];
}
請您澄清「我/照片」和「我/喂」之間的區別。就像什麼時候我們需要使用哪一個一樣。還有更多其他選項可用。你能詳細解釋一下嗎? – Satyam 2013-01-11 13:58:08