cocoa - iPhone URL Request: Add value to HTTP header field -


I am trying to add a value to the header for a URL request.

Something works fine:

  [urlRequest addValue: @ "gzip" forHTTPHeaderField: @ "accept-encoding"];  

but it is also not visible in the title:

  NSString * authString = [[NSString alloc] initWithString: [default ObjectForcae: @ "Certification" ]]; [UrlRequest addValue: authString forHTTPHeaderField: @ "iphoneID"];  

I'm completely stumped. The authorit string is about 90 characters long Is this a problem?

Edit: I'm trying this code:

  NSString * authString = [[NSString alloc] initWithString: [Error Object Farki : @ "At"]]; [UrlRequest addValue: authString forHTTPHeaderField: @ "iphoneid"]; [UrlRequest addValue: @ "gzip" forHTTPHeaderField: @ "Accept-Encoding"];  

I can accept that acceptable-encoding headers are being sent through wireshark, but iPhid is not anywhere. It's just a string, it's 80-90 characters long.

Another update: It seems that the problem area is not "iphoneid" but I'm trying authString to pass it to the other string which i get @ "something" , But I do not see the AUTH string which I pull from NSUserDefaults.

How to debug it but suggestions?

The correct problem is.

The string that was pulling from NSUserDefaults had already ended one line. When set as the header, another \ r \ n is added, which is not apparently valid. Thus, the header will not appear in any outgoing packet.

Fix:

Use this to touch the letter before setting the header value.

[yourString stringByTrimmingCharactersInSet: [NSCharacterSet whitespaceAndNewlineCharacterSet]];


Comments