RedSIght
RedSIght

Reputation: 728

iOS App crash without any exception when set UIImage to UIImageView

I am facing a problem that is quite strange. I just want to set an ImageLiteral to the UIImageView and it crashes the app without popping up any error or exception. It tried it in simulator and everything is ok. But when I install my app on iPad (6th) iOS 13.6, it crashed.

The project is working fine on 2019/8/15. I just pull it and rebuild on real device, didn't change a thing for this part. The deployment target version is iOS 10. Maybe it's because I didn't config the dark mode things? Any idea?

@IBOutlet weak var anatomyImgView: UIImageView!
anatomyImgView.image = #imageLiteral(resourceName: "bodyoutline_black")

Update:

Here's the image configuration

enter image description here

enter image description here

Upvotes: -1

Views: 544

Answers (1)

Rikh
Rikh

Reputation: 4222

It can be one of two things:

  1. The syntax should be #imageLiteral(resourceName: "bodyoutline_black").
  2. The spelling is different.

Quickest way to check is if the image icon appears inside the code and doesn't appear as a placeholder.

Upvotes: -1

Related Questions