I have a warning:
/Users/pholahem/Documents/development/ohmycode_pro/ohmycode_pro/Pods/AFNetworking/AFNetworking/AFHTTPClient.m:92:40: 'CFURLCreateStringByAddingPercentEscapes' is deprecated: Use [NSString stringByAddingPercentEncodingWithAllowedCharacters:] instead.
on Xcode for the following code:
static NSString * AFPercentEscapedQueryStringKeyFromStringWithEncoding(NSString *string, NSStringEncoding encoding) {
static NSString * const kAFCharactersToLeaveUnescapedInQueryStringPairKey = @"[].";
return (__bridge_transfer NSString *)CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault, (__bridge CFStringRef)string, (__bridge CFStringRef)kAFCharactersToLeaveUnescapedInQueryStringPairKey, (__bridge CFStringRef)kAFCharactersToBeEscapedInQueryString, CFStringConvertNSStringEncodingToEncoding(encoding));
}
static NSString * AFPercentEscapedQueryStringValueFromStringWithEncoding(NSString *string, NSStringEncoding encoding) {
return (__bridge_transfer NSString *)CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault, (__bridge CFStringRef)string, NULL, (__bridge CFStringRef)kAFCharactersToBeEscapedInQueryString, CFStringConvertNSStringEncodingToEncoding(encoding));
}
I tried to read documentation on how to use the stringByAddingPercentEncodingWithAllowedCharacters
way but I could not figure out how to rewrite the wrong code with the right function.
Any help will be highly appreciated.