我一直在尝试使用 facebook graph API 在 facebook 上发布照片。验证用户身份后,我正在执行以下操作
NSMutableDictionary *variables = [[NSMutableDictionary alloc]init];
[variables setObject:@"some text" forKey:@"message"];
[variables setObject:@"some link" forKey:@"link"];
[variables setObject:[UIImage imageNamed:@"icon@2x.png"] forKey:@"picture"];
NSString *str = @"me/feed";
NSLog(@"str: %@", str);
FbGraphResponse *resp = [self.fbGraph doGraphPost:str withPostVars:variables];
NSLog(@"resp: %@", resp.htmlResponse);
但是我的应用程序因抛出异常而崩溃:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException',
reason: -[UIImage dataUsingEncoding:]: unrecognized selector sent to instance 0x11545140'
所以有人可以帮助我如何使用图形 API 在 Facebook 墙上发布图像以及一些消息。