Closed ablyBikramjeet closed 4 years ago
This because SDWebImage’s cache system, by default use an agressive cache control based on Native code’s expiration age and size. It does not follow any HTTP cache control like Cache-Control Etag...
For this case, you can use the .refreshCached
option, which will use the HTTP cache control, if your server update the remote resource, the exist cache will be replaced
Thanks for your quick response.
I am explaining you please help me :-
Suppose I have used cell.cuisinesImageView.sd_setImage(with: cellVM.cuisineImageURL). and all images comes in without .svg format. In this case everything working fine.
But I want to show .SVG images and put the below code
let SVGCoder = SDImageSVGCoder.shared SDImageCodersManager.shared.addCoder(SVGCoder) cell.cuisinesImageView.sd_setImage(with: cellVM.cuisineImageURL)
In this case nothing happed always previous image shows.
So please tell me how I can resolve this problem.
One more thing .svg image not showing as original these are. From backend I got coloured images but when i shows in my code in is showing black and white. How I resolved this issue also.
let SVGCoder = SDImageSVGCoder.shared SDImageCodersManager.shared.addCoder(SVGCoder)
This code is the setup code, you should always put it on the AppDelegate (or anything after launch), not before View Controller load and execute multiple times.
Then, can you try to load these SVG files in Xcode 11 ? Xcode 11 support the SVG vector format, if this can not showing correctly in Xcode, it can not showing correctly in iOS as well. The iOS 13 system support for SVG is not always 100% compatbile for W3C SVG standard, which is a subset.
From backend I got coloured images but when i shows in my code in is showing black and white. How I resolved this issue also.
Sorry, I didn't catch with this description at the above comment.
iOS UIImageView can render symbol as vector image (template), which have a Tint Color. Can be used to render the desired color. The SVG is one type of symbol image, so it also follow that design (allows you to override the color)
Which means, if you need to render SVG, you'd better configurate your UIImageView/UIImage to use the original image. Maybe I need to update some code about this framework ?
UIImage *originalImage;
UIImage *image = [originalImage imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
imageView.image = image;
// Or
UIImageView.tintColor = UIColor.clearColor;
See more here: Configuring and Displaying Symbol Images in Your UI
Can you upload those SVG have rendering issue here, to let me test it on our demo project ?
Hello @dreampiggy ,
Thanks a lot for your response.
Here, am sending you .svg images URL so you can used this in your demo project.
1) http://test.yoyumm.4livedemo.com/image/cuisines/3/400/400 2) http://test.yoyumm.4livedemo.com/image/cuisines/2/400/400
Please let me know. What is your feedback on this.
Waiting for your positive response.
Thanks & Best Regards,
Works on Demo:
Can you tell me the steps how you can doing this.
One silly question : Are you using SVGKit (which this coder v0.1-0.3 based on, now deprecated) ? It moved to another repo, fire issue there SDWebImageSVGKitPlugin.
But actually, for any Render issue related to SVGKit, we can not help. Because they're not active developed, and no one contribute code there. We have no knowledge to modify that third party library to figure out the SVG implementation issues.
Can you tell me the steps how you can doing this.
Just using the code in the demo project. Like this:
NSURL *svgURL = [NSURL URLWithString:@"http://test.yoyumm.4livedemo.com/image/cuisines/3/400/400"];
UIImageView *imageView1 = [[UIImageView alloc] init];
imageView1.frame = CGRectMake(0, 0, screenSize.width, screenSize.height / 2);
imageView1.contentMode = UIViewContentModeScaleAspectFit;
[imageView1 sd_setImageWithURL:svgURL];
@dreampiggy Can you tell which pod i need to install. It's good if you can send me demo project.
....This GitHub repo itself? I can not get the point. This repo is what we called SVG plugin 😅
Wait please let me know which pod file i need to install in my project.
pod 'SDWebImageSVGCoder' pod 'SDWebImageSVGKitPlugin'
@dreampiggy I have used below step according to your suggestion but not able to show .svg image.
Step 1. I have created project in Objective C. Step 2. I have installed below mentioned pods :- pod 'SDWebImageSVGCoder' pod 'SDWebImageSVGKitPlugin Step 2. I have include #import <SDWebImageSVGCoder/SDWebImageSVGCoder.h> and this code in App Delegate File. SDImageSVGCoder *SVGCoder = [SDImageSVGCoder sharedCoder]; [[SDImageCodersManager sharedManager] addCoder:SVGCoder];
Step3. According your last message I have done below Code in View Controller. NSURL svgURL = [NSURL URLWithString:@"http://test.yoyumm.4livedemo.com/image/cuisines/3/400/400"]; UIImageView imageView1 = [[UIImageView alloc] init]; imageView1.frame = CGRectMake(100.0, 200.0, 200.0, 200.0); imageView1.contentMode = UIViewContentModeScaleAspectFit; [imageView1 sd_setImageWithURL:svgURL]; [imageView1 setBackgroundColor:UIColor.redColor]; [self.view addSubview:imageView1]; and Got this output -
Please help me...
http
Enable the App Transport Security -> Allow arbitrary load in Info.plist
@dreampiggy . Thanks a lot for your response and am able to do this in demo project with Objective-C and Swift also but am unable to do this my actually project can you tell me any solution for this.
@dreampiggy . Thanks a lot for your response and am able to do this in demo project with Objective-C and Swift also but am unable to do this my actually project can you tell me any solution for this.
Emm. Maybe it's about something your real project's ImageView configuration ? Or you test device's system ?
SDImageCodersManager.sharedManager.coders
array contains this SVG Coder-[SDImageSVGCoder decodeImageWithData:options:]
, see result whether this is get called Sure @dreampiggy . Thanks a lot for your support...
This plugin is actually backward-deployable. If you need to support both iOS 12/13, you need to use these two plugins at the same time.
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
if #available(iOS 13, *) {
SDImageCodersManager.shared.addCoder(SDImageSVGCoder.shared)
} else {
SDImageCodersManager.shared.addCoder(SDImageSVGKitCoder.shared)
}
return true
}
Hello Team,
Thanks a lot for make a good library for SVG images.
I want to show both .SVG and any-other type of image. I have showed images successfully but the problem is when i update the image from server but am showing previous image. Run time changed images not working. Please suggest me how i can show new images at run time. Thanks.