Wes Cossick
Wes Cossick

Reputation: 2933

NSInvalidArgumentException - setAllHTTPHeaderFields

New to iOS app programming. There's probably an easy fix, but I apparently don't know it. The following is the code in question:

NSDictionary * headers = [NSHTTPCookie requestHeaderFieldsWithCookies:cookies];
[theRequest setAllHTTPHeaderFields:headers];

And this is the exception being thrown:

[NSURLRequest setAllHTTPHeaderFields:]: unrecognized selector sent to instance 0x1d82a7e0

Any help would be greatly appreciated! Please let me know if you need any further info.

Upvotes: 2

Views: 626

Answers (2)

MontiRabbit
MontiRabbit

Reputation: 1030

I was facing the same error using setAllHTTPHeaderFields: In my case, I was sending non NSString parameters in the Dictionary.

Upvotes: 0

hd1
hd1

Reputation: 34677

You may need to use an NSMutableURLRequest instead of an NSURLRequest.

Upvotes: 4

Related Questions