This is deprecated "stringByAddingPercentEscapesUsingEncoding", I want to replace this line with update one.
NSString *encodedString = [modalData.imageURL stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
Try below line of code:
NSString *encodedString = [modalData.imageURL stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLHostAllowedCharacterSet]];
stringByAddingPercentEncodingWithAllowedCharacters:
Returns a new string made from the receiver by replacing all characters not in the specified set with percent encoded characters.
Character sets are passed to - stringByAddingPercentEncodingWithAllowedCharacters:
+ (NSCharacterSet *)URLUserAllowedCharacterSet;
+ (NSCharacterSet *)URLPasswordAllowedCharacterSet;
+ (NSCharacterSet *)URLHostAllowedCharacterSet;
+ (NSCharacterSet *)URLPathAllowedCharacterSet;
+ (NSCharacterSet *)URLQueryAllowedCharacterSet;
+ (NSCharacterSet *)URLFragmentAllowedCharacterSet;
Reference: https://developer.apple.com/reference/foundation/nsstring/1411946-stringbyaddingpercentencodingwit
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With