Open SubhadipDutta93 opened 6 years ago
Don't use XCAsset
heap buffer overflow ... library crashed
@SubhadipDutta93 and others what I did is:
imageView.image = UIImage.gif(name: gifName)
public class func gif(name: String) -> UIImage? {
guard let bundleURL = Bundle.main
.url(forResource: name, withExtension: "gif") else {
print("SwiftGif: This image named \"\(name)\" does not exist")
return nil
}
guard let imageData = try? Data(contentsOf: bundleURL) else {
print("SwiftGif: Cannot turn image named \"\(name)\" into NSData")
return nil
}
return gif(data: imageData)
}
works like a charm
+1 for this - didn't work in the Assets folder, worked find elsewhere
Once i run my app in the debug terminal it shows this - "SwiftGif: Cannot turn image named "battery" into NSDataAsset" how to solve this problem? Thanks in advance.