本文介绍了Facebook的照片的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要在Facebook上上传照片。但似乎是不可能的。我总是在控制台中有相同的崩溃[UIImage dataUsingEncoding:]我得到我的图像的方式:
- ( void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
[self dismissModalViewControllerAnimated:YES];
if([mediaType isEqualToString:@public.image]){
_photoImage1 = [[info objectForKey:@UIImagePickerControllerOriginalImage] retain];
所有需要的权限:
- (void)uploadPhotoToFacebook {
NSMutableDictionary * args = [[[NSMutableDictionary alloc] init] autorelease];
[args setObject:_photoImage1 forKey:@image];
[args setObject:@hello test pictureforKey:@caption];
FBRequest * uploadPhotoRequest = [FBRequest requestWithDelegate:self];
[uploadPhotoRequest call:@photos.uploadparams:args];
它在FBRequest.m中的这种方法之后崩溃了
$ b $($)$($)$($)$($)$($)$($)$($)
}
提前感谢
解决方案
尝试添加图像为dataParam
NSMutableDictionary * params = [[[ NSMutableDictionary alloc] init] autorelease];
[params setObject:@NAMEforKey:@caption];
[[FBRequest requestWithDelegate:self] call:@facebook.photos.uploadparams:params dataParam:UIImagePNGRepresentation(_photoImage1)];
I need to upload photo on Facebook. But it seems to be impossible. I always have the same crash in console [UIImage dataUsingEncoding:]The way I get my Image:
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info{
[self dismissModalViewControllerAnimated:YES];
if ([mediaType isEqualToString:@"public.image"]){
_photoImage1 = [[info objectForKey:@"UIImagePickerControllerOriginalImage"] retain];
After all needed permissions:
-(void)uploadPhotoToFacebook {
NSMutableDictionary *args = [[[NSMutableDictionary alloc] init] autorelease];
[args setObject:_photoImage1 forKey:@"image"];
[args setObject:@"hello test picture" forKey:@"caption"];
FBRequest *uploadPhotoRequest = [FBRequest requestWithDelegate:self];
[uploadPhotoRequest call:@"photos.upload" params:args];
It has crash after such a method in FBRequest.m
- (void)utfAppendBody:(NSMutableData*)body data:(NSString*)data {
[body appendData:[data dataUsingEncoding:NSUTF8StringEncoding]];
}Thanks in advance.
解决方案
Try to add image as dataParam
NSMutableDictionary *params = [[[NSMutableDictionary alloc] init] autorelease];
[params setObject:@"NAME" forKey:@"caption"];
[[FBRequest requestWithDelegate:self] call:@"facebook.photos.upload" params:params dataParam:UIImagePNGRepresentation(_photoImage1)];
这篇关于Facebook的照片的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!