title: How can transform this Postman Request into iOs Code
body: <p>I got the following Postman request which works fine (Screenshot <a href="http://postimg.org/image/s7zm3qhvh/" rel="nofollow">http://postimg.org/image/s7zm3qhvh/</a>). But when i try the same in iOS it will not work. Maybe someone can give me some information why.</p>
  
  <p>My Objective-c Code:</p>
  
  <pre><code>UIImage *yourImage= [UIImage imageNamed:@"login-main-bg.png"];
  
  
  NSString *imageString = [UIImagePNGRepresentation(yourImage) base64Encoding];
  
  NSDictionary *dict = [NSDictionary dictionaryWithObjectsAndKeys:
                        imageString, @"image",
                        nil];
  NSError *error;
  
  NSData* jsonData = [NSJSONSerialization dataWithJSONObject:dict options:NSJSONWritingPrettyPrinted error:&amp;error];
  if (error) {
      NSLog(@"%@",[error localizedDescription]);
  }
  NSString *postLength = [NSString stringWithFormat:@"%lu", (unsigned long)[jsonData length]];
  
  NSMutableURLRequest *request = [[NSMutableURLRequest alloc] init];
  [request setURL:[NSURL URLWithString:@"http://server.website.net/api/collaboration/ImageTest"]];
  [request setHTTPMethod:@"POST"];
  [request setValue:@"multipart/form-data" forHTTPHeaderField:@"Content-Type"];
  [request setValue:@"application/json" forHTTPHeaderField:@"Accept"];
  [request setValue:postLength forHTTPHeaderField:@"Content-Length"];
  [request setHTTPBody:jsonData];
  
   //print json:
  NSLog(@"JSON summary: %@", [[NSString alloc] initWithData:jsonData
                              encoding:NSUTF8StringEncoding]);
  NSURLConnection *connection = [[NSURLConnection alloc] initWithRequest:request delegate:self];
  [connection start];
  </code></pre>
  
  <p>I hope someone can help me! Thank you!</p>