2012-04-27 145 views
0

AI我用下面的代碼後的圖像用戶的牆在Facebook上通過圖形API在fb牆上發佈圖像的問題?

NSData *imageData =UIImagePNGRepresentation(newPageView.image); 
    UIImage *picture = [UIImage imageWithData:imageData]; 
    NSLog(@"picture is %@",picture); 
    NSMutableDictionary *variables = [NSMutableDictionary dictionaryWithCapacity:2]; 

     FbGraphFile *graph_file = [[FbGraphFile alloc] initWithImage:picture]; 

    [variables setObject:graph_file forKey:@"file"]; 

    [variables setObject:@"this is a test message: postPictureButtonPressed" forKey:@"message"]; 


    FbGraphResponse *fb_graph_response = [fbGraph doGraphPost:@"/me/photos" withPostVars:variables]; 

上面的照片後置代號圖像I album.how可以改變它張貼在牆上的形象?

回答

1

試試這個代碼

NSURL *url = [NSURL URLWithString:@"YOur Image url"]; 
    NSData *data = [NSData dataWithContentsOfURL:url]; 
    UIImage *img = [[UIImage alloc] initWithData:data]; 

    [variables setObject:img forKey:@"picture"]; 


    FbGraphResponse *fb_graph_response = [fbGraph doGraphPost:@"/me/photos" withPostVars:variables]; 
+1

'offline_access'是)棄用二)不需要發佈 – zerkms 2012-04-27 10:31:50

+0

我已經列入我的代碼發佈流,你可以看到它 – Bhoomi 2012-04-27 10:33:08

+0

看到我的更新答案 – Deepesh 2012-04-27 10:50:57

相關問題