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?

有帮助吗?

解决方案

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

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top