title: How to post a photos on facebook through iPhone app?
body: <p>I am trying to post image on facebook but not successful yet,
  my codes are:</p>
  
  <pre><code>- (void)postToWall{
  
  int im = 1;
  NSData *myimgData; 
  myimgData = [NSData dataWithContentsOfFile:saveImagePath];
  //pstimg = myimgData;
  NSArray *chunks = [pstimg componentsSeparatedByString: @"."];
  NSString *atch= [chunks objectAtIndex: 0];
  
  
  
  NSString *filePath = [[NSBundle mainBundle] pathForResource:atch ofType:@"jpg"];  
  
  
  img  = [[UIImage alloc] initWithContentsOfFile:filePath];
  
  //start
  
  FBDialog* dialog = [[[FBStreamDialog alloc] init] autorelease];
  
  NSString *str = @"Hello"; 
  str = [str stringByReplacingOccurrencesOfString:@" " withString:@"+"];
  dialog.cMessage=str;
  
  dialog.userMessagePrompt = @"Enter your message:";
  
  
  [dialog show];
  
  NSData * findata;
  
  
      //edited from here
  
  
      if(im==1)
      {
          findata = myimgData;    
  
      }
      else
      {
          findata  = (NSData *)img;   
  
      }
  
      NSMutableDictionary * param = [NSMutableDictionary dictionaryWithObjectsAndKeys:
                                     img, @"picture",
                                     nil];
  
      FBRequest *uploadPhotoRequest =[FBRequest requestWithDelegate:self] ;
      [uploadPhotoRequest call:@"facebook.photos.upload" params:param dataParam:myimgData];
  
  
  
      [img release];
  </code></pre>
  
  <p>}</p>
  
  <p>But it not posted.</p>