Using web services is a very common part of development for any iOS developer who is building a dynamic iOS application. Sometimes you may be doing everything correct, but not getting the desired response. You may not be able to consume a web service. Out of the many possible solutions, one solution is to set the forHTTPHeaderField value as follows:
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL: your_url];
[request setValue:@”application/json” forHTTPHeaderField:@”Content-Type”];[request setValue:@”application/json” forHTTPHeaderField:@”Accept”];
Similarly, if you are using AFNetworking:
AFJSONRequestSerializer *serializer = [AFJSONRequestSerializer serializer];[serializer setValue:@”application/json” forHTTPHeaderField:@”Content-Type”];[serializer setValue:@”application/json” forHTTPHeaderField:@”Accept”];
Princeton IT is the leading mobile application development company in USA. Get in touch!