0

As I am replacing the double quote with escape char as mentioned in below in code. The Same code works fine in iOS 10.x and not working in iOS 11.

NSString *searchStr = [searchBar.text stringByReplacingOccurrencesOfString:@"\"" withString:@"\\\""];

NSString *searchInput = [[NSString alloc] initWithFormat:@"{\"@type\": \"com.xyz.rest.find.SearchQuery\",\"value\": \"%@\"}", searchStr];

NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:url]];
[request setHTTPMethod:@"POST"];
[request setValue:@"application/json" forHTTPHeaderField:@"Accept"];
[request setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
[request setHTTPBody:[searchInput dataUsingEncoding:NSUTF8StringEncoding]];

Any leads will be appreciated !!!!

Thanks in advance

1 Answers1

2

This may be because of smart punctuation introduced in iOS 11. Please check below link.

https://www.reddit.com/r/apple/comments/778otd/ios_11_no_longer_encodes_double_quotes_as_the/

Kishan Lal
  • 121
  • 7