title: iPhone - How to post image on friend's facebook wall
body: <pre><code>if ([FBSession.activeSession.permissions indexOfObject:@"publish_actions"] == NSNotFound)
  {
          // No permissions found in session, ask for it
      [FBSession.activeSession reauthorizeWithPublishPermissions:[NSArray arrayWithObject:@"publish_actions"]
                                                     defaultAudience:FBSessionDefaultAudienceFriends
                                                   completionHandler:^(FBSession *session, NSError *error)
      {
               // If permissions granted, publish the story
           if (!error)
           {
               [self postImageToFB] ;
           }
      }];
  }
      // If permissions present, publish the story
  else
  {
      [self postImageToFB] ;
  }
  - (void) postImageToFB
  {
      NSData* imageData = UIImageJPEGRepresentation(self.image, 90);
      NSMutableDictionary * params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
                                      @"test", @"message",
                                      imageData, @"source",
                                      nil];
  
      [FBRequestConnection startWithGraphPath:[NSString stringWithFormat:@"%@/photos",friendName]
                                   parameters:params
                                   HTTPMethod:@"POST"
                            completionHandler:^(FBRequestConnection *connection, id result, NSError *error)
      {
           NSLog(@"%@",error) ;
           if( error == NULL )
           {
               UIAlertView *alert = [[UIAlertView alloc] initWithTitle:nil
                                                               message:@"Post sucessed!!"
                                                              delegate:nil
                                                     cancelButtonTitle:@"OK"
                                                     otherButtonTitles:nil] ;
               [alert show] ;
           }
      }];
  }
  </code></pre>
  
  <p>I can use <code>- (void) postImageToFB</code> function to post on my own wall when I change <code>[NSString stringWithFormat:@"%@/photos",friendName]</code> to <code>@"me/photos"</code></p>
  
  <p>But I can't post on my friend's wall , maybe permission is wrong or there are some problem I didn't know ?</p>
  
  <p>I got these error</p>
  
  <pre><code>Error Domain=com.facebook.sdk Code=5 "The operation couldn’t be completed. (com.facebook.sdk error 5.)" UserInfo=0xc0a7320 {com.facebook.sdk:ErrorInnerErrorKey=Error 
  Domain=NSURLErrorDomain Code=-1000 "bad URL" UserInfo=0xc001ea0 {NSUnderlyingError=0xaa45270 "bad URL", NSLocalizedDescription=bad URL}, com.facebook.sdk:HTTPStatusCode=200}
  </code></pre>