vikifor
vikifor

Reputation: 3466

Add custom http header request swift iOS

I have iOS8 swift application which communicate to web service URL. However, I do not like to have access to my web service from device that is not mobile device. How can I achive this using iOS8 swift application. In fact I need HTTP header, that have device-specific information using NSURLConnection.

Upvotes: 1

Views: 1620

Answers (1)

David Berry
David Berry

Reputation: 41226

Make sure you create a NSMutableURLRequest and then use the method:

request.setValue("multipart/form-data; boundary=\(boundary)", forHTTPHeaderField: "Content-Type")

Upvotes: 1

Related Questions