From 5c3bfe69fa2692fcc3113bf9a66da0e7233d4648 Mon Sep 17 00:00:00 2001 From: ImmacommaMac Date: Wed, 16 May 2018 20:10:14 +0300 Subject: [PATCH] Fix image url with empty spaces or non ASCII characters --- ios/iphone/Classes/AvImageviewImageView.m | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/ios/iphone/Classes/AvImageviewImageView.m b/ios/iphone/Classes/AvImageviewImageView.m index adc3ab1..ac7491f 100644 --- a/ios/iphone/Classes/AvImageviewImageView.m +++ b/ios/iphone/Classes/AvImageviewImageView.m @@ -118,7 +118,12 @@ -(void)displayImage:(id)imageObj [imageView sd_cancelCurrentImageFetch]; if ([imageObj isKindOfClass:[NSString class]]) { - NSURL *imageUrl = [NSURL URLWithString:[TiUtils stringValue:imageObj]]; + //fix downloading the image if url contains spaces or none ASCII characters + //source : https://stackoverflow.com/questions/1441106/nsdata-nsurl-url-with-space-having-problem + NSString * srtImageUrl = [TiUtils stringValue:imageObj]; + srtImageUrl = [srtImageUrl stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; + + NSURL *imageUrl = [NSURL URLWithString:srtImageUrl]; if (loadingIndicator) { activityIndicator.hidden = NO;