Pergunta

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?

Foi útil?

Solução

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

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top