SDWebImage / SDWebImageSVGCoder

A SVG coder plugin for SDWebImage, using Apple's built-in framework
MIT License
103 stars 34 forks source link

Redefinition of 'SDImageFormatSVG' #21

Closed bibin-jaimon closed 4 years ago

bibin-jaimon commented 4 years ago

When I install these two libraries using CocoaPod 'SDWebImage' and 'SDWebImageSVGCoder'.

I got error says that 'static const SDImageFormat SDImageFormatSVG = 8' is redefined in

  1. NSData+ImageContentType.h in SDWebImage Module

  2. SDImageSVGCoder.h in SDWebImageSVGCoder plugin module

Screenshot 2020-03-24 at 12 22 55 AM

Screenshot 2020-03-24 at 12 22 41 AM

How can I resolve this issue?

dreampiggy commented 4 years ago

@bibinvazhappillil If you update the SDWebImage to 5.6.0 version, the SVG/PDF coder should also bump to the latest one, because the image type is now built-in.

Update : https://github.com/SDWebImage/SDWebImageSVGCoder/releases/tag/1.5.0

eddielisands commented 4 years ago

I am using the latest version from cocoapods and still get the same error.

dreampiggy commented 4 years ago

Could you please show me your Podfile.lock after install SDWebImage && SDWebImageSVGCoder ? You can specify the fixed version in your Podfile:

pod 'SDWebImage', '5.6.0'
pod 'SDWebImageSVGCoder', '1.5.0'
dreampiggy commented 4 years ago

Or clean the CocoaPods cache and re-pod install

pod cache clean SDWebImage --all
pod cache clean SDWebImageSVGCoder --all
eddielisands commented 4 years ago

Because my app supports from iOS 12.0, so I couldn't install the latest 'SDWebImageSVGCoder' from cocoapods. Installing CocoaLumberjack (3.6.1) Installing SDWebImage (5.6.1) Installing SDWebImageSVGCoder (0.3.0) Installing SVGKit (2.1.1)

dreampiggy commented 4 years ago

For SDWebImageSVGCoder < 1.0 version, it actually use the SVGKit.

You should migrate to SDWebImageSVGKitPlugin. The SVGKitPlugin 1.2.0 supports SDWebImage 5.6.0. See more about these two different SVG solution.

https://github.com/SDWebImage/SDWebImageSVGCoder#note-for-svgkit-user

dreampiggy commented 4 years ago

And this release note: https://github.com/SDWebImage/SDWebImageSVGCoder/releases/tag/1.0.0

SVGKitPlugin and SVGCoder are totally different codec. For SVGKitPlugin, it supports iOS 8 && macOS 10.10+, which use a Third party (not Apple written) SVGKit dependency

For SVGCoder, in before 0.3.0 it's actually what current SVGKitPlugin looks like, but since iOS 13 && macOS 10.15 provide the Native support (Apple written), we use Apple's native support instead in 1.0.0 version.

dreampiggy commented 4 years ago
pod 'SDWebImage', '5.6.0'
pod 'SDWebImageSVGKitPlugin', '1.2.0'

Just change your previous SDImageSVGCoder into SDImageSVGKCoder, any other things not changed.

bibin-jaimon commented 4 years ago

The problem solved when I install

pod 'SDWebImage', '~> 5.0' pod 'SDWebImageSVGKitPlugin'

Thanks,

mehmetdelikaya commented 2 years ago

@dreampiggy hi there, I am having issue for displaying a remote svg image via its url in iOS application. I have tried the above versionings but no luck. Can you check if you can display the image that i am trying to load? I am also attaching a ss for the expected image

https://storage.opensea.io/files/ecba7c2eb4fbe1f65e8d3f807886a7c8.svg

Screen Shot 2022-01-06 at 20 40 09