Domanda

I have following code in my .net app.

MessageHeader<string> mhg = new MessageHeader<string>(SomeTicket);
     MessageHeader header = mhg.GetUntypedHeader("MessageName", "Namespace");
     OperationContext.Current.OutgoingMessageHeaders.Add(header);

So i want to put the same message header from ios app by using NSMutableUrlRequest class, how to implement the same functionality from ios?

È stato utile?

Soluzione

You can use following instance methods of NSMutableURLRequest class. If you use first one, you have to pass dictionary with key-value pairs that you want to send in request headers. If you use second one, you can directly add headers one by one.

- (void)setAllHTTPHeaderFields:(NSDictionary *)headerFields

- (void)addValue:(NSString *)value forHTTPHeaderField:(NSString *)field

For more details read documentation

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top