大佬教程收集整理的这篇文章主要介绍了如何从iphone sdk上传多个图像到Facebook,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
AppDelegate *delegate = (AppDelegate *)[[UIApplication sharedApplication] delegate]; NSString *jsonrequest1 = @"{ \"method\": \"POST\",\"relative_url\": \"me/photos\",\"body\": \"Hello 1\",\"attached_files\": \"file1\" }"; NSString *jsonrequest2 = @"{ \"method\": \"POST\",\"body\": \"Hello 2\",\"attached_files\": \"file2\" }"; NSString *jsonrequestsArray = [NSString StringWithFormat:@"[ %@,%@ ]",jsonrequest1,jsonrequest2]; NSMutableDictionary *params = [NSMutableDictionary DictionaryWithObjectsAndKeys:jsonrequestsArray,@"batch",nil]; NSString *url1=@"http://uhallnyu.files.wordpress.com/2011/11/green-apple.jpg"; NSString *url2=@"http://scm-l3.technorati.com/12/04/24/67277/apple.gif?t=20120424140104"; NSData *data1 = [NSData dataWithContentsOfURL:[NSURL URLWithString:url1]]; UIImage *img1 = [[UIImage alloc] initWithData:data1]; NSData *data2 = [NSData dataWithContentsOfURL:[NSURL URLWithString:url2]]; UIImage *img2 = [[UIImage alloc] initWithData:data2]; [params setObject:img1 forKey:@"file1"]; [params setObject:img2 forKey:@"file2"]; [[delegate facebook] requestWithGraPHPath:@"me/Feed" andParams:params andhttpR_537_11845@ethod:@"POST" andDelegate:self];
NSData *yourImageData= UIImagePNGRepresentation(yourImagE);
初始化字典: –
NSMutableDictionary *mutableDictWithParam= [NSMutableDictionary DictionaryWithObjectsAndKeys:@"Your text",@"message",yourImageWithData,@"thesource",nil];
最后发帖子: –
[facebook requestWithGraPHPath:@"/me/photos" andParams:mutableDictWithParam andhttpR_537_11845@ethod:@"POST" andDelegate:self];
您可以循环播放多个图像.
以上是大佬教程为你收集整理的如何从iphone sdk上传多个图像到Facebook全部内容,希望文章能够帮你解决如何从iphone sdk上传多个图像到Facebook所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。