views:

22

answers:

0

Hi to everybody. 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.