Tôi làm cách nào để tải ảnh lên facebook từ ứng dụng iOS bằng API/SDK mới của mình? Tôi đã cố gắng và tôi không nhận được bất cứ nơi nào, chỉ cần tiếp tục chạy trong vòng tròn. Đây là mã Tôi hiện có:Tải ảnh lên bằng API SDK Facebook SDK mới (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];
}];
}
Bạn có thể làm rõ sự khác biệt giữa "tôi/ảnh" và "tôi/nguồn cấp dữ liệu" hay không. Giống như khi nào chúng ta cần phải sử dụng cái nào trong số đó. Và còn nhiều tùy chọn khác nữa. Bạn có thể giải thích ít chi tiết xin vui lòng. – Satyam