Curl file upload -F post request in objective c

I'm not sure how to implement post request equivalent to this curl request:

curl -F=@file.json https://www.example.com/?id=some_id


I tried creating an NSDictionary equivalent my json,


jsondata = [NSJSONSerialization dataWithJSONObject:dict options:NSJSONWritingPrettyPrinted error:&error];
NSMutableURLRequest * request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https:/ [request setHTTPMethod:@"POST"];
[request setHTTPBody:jsondata];
But something is wrong as it doesn't work. Pls help if you know what's the problem. How can I post a nsdictionary? I'm getting a success response, but when I open the url its blank

But something is wrong as it doesn't work.

It’s hard to offer any advice without more details. What doesn’t work? It doesn’t compile? It gets some sort of transport error talking to your server? Or your server doesn’t interpret the

POST
correctly?

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

I'm getting a success response, but when I open the url its blank
It gives me id, which i can use to get the posted data via get request, but when I get it it's blank.

You can find my general advice on this topic in Debugging HTTP Server-Side Errors. The basic idea is to use a debugging proxy (or a lower-level packet trace tool) to compare a successful request (from

curl
) and an unsuccessful request (from your app) to see how they differ.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"
Curl file upload -F post request in objective c
 
 
Q