0

I'm using Xcode 12.4 and I want to use GIF image in my app.

So I put GIF Image in Assets.xcassets folder.

But UIImage can't recognize the GIF file with this error message

CoreUI: attempting to lookup a named image 'imgname' with a type that is not a data type in the AssetCatalog

enter image description here

When I open Assets.xcassets folder in xcode, the file is represented like above image.

How to solve this error? I use code to get image

UIImage.animatedImage(with: [UIImage(named: "img_name")!], duration: 15.0)

Thank you.

Gereon
  • 17,258
  • 4
  • 42
  • 73
Gabul
  • 21
  • 6

1 Answers1

0

That's because UIImage is not support file in data set.

You must use NSDataAsset to load gif data from data set

yycking
  • 1,017
  • 1
  • 9
  • 14