If you are using the CFNetwork framework, you can use the the
CFHTTPMessageSetHeaderFieldValue method method of the CFHTTPMessage class. See the code listing in Creating a CFHTTP Request in the CFNetwork Programming Guide for an example of this approach.
If you are using URLConnection, or any of its subclasses (
HttpsURLConnection), you can use its
addRequestProperty(String field, String new Value) method method to add the HTTP header. The following example demonstrates adding the
x-native-id header using this method: