2012-09-19 3 views

답변

3

시도해보십시오. 도움이 될 것입니다. 후 조치 방법에서
사진을 공유하려면 다음 코드를 작성하십시오.

NSMutableDictionary *variables = [NSMutableDictionary dictionaryWithCapacity:1]; 
NSURL *imageURL = [[NSURL alloc] initWithString:@"http://track_images/images/20120209104734baby-puppy.jpg"]; 
NSData *imageData = [[NSData alloc] initWithContentsOfURL:imageURL]; 
UIImage *picture = [UIImage imageWithData:imageData];  
FbGraphFile *graph_file = [[FbGraphFile alloc] initWithImage:picture]; 
[variables setObject:graph_file forKey:@"file"]; 
FbGraphResponse *fb_graph_response = [fbGraph doGraphPost:@"117795728310/photos" withPostVars:variables]; 
NSString *res = fb_graph_response.htmlResponse; 
NSLog(@"res>> %@",res); 
NSRange wordRange = NSMakeRange(0,2); 
NSArray *firstWords = [[res componentsSeparatedByString:@"\""] subarrayWithRange:wordRange]; 

if (![[firstWords objectAtIndex:1] isEqualToString:@"error"]){ 
//alert for image posted sucessfully. 
} 
else{ 
//alert for image not posted sucessfully. 

} 
+0

감사합니다 murali하지만 ** "좋아요"** 기능을 도와 줄 수 있습니까? –

+0

이것을 시도하십시오 : FbGraphResponse * fb_graph_response = [fbGraph doGraphPost : @ "117795728310/likes"withPostVars : variables]; – iSpark

관련 문제