Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS 14 only issue: images in keyboard extension no longer displays (but works fine in iOS 13)

I have an iOS keyboard extension that displays rows of UIImageViews in a scroll view.

Addendum, for clarity: the exact same codebase produces two very different results on two different iOS versions. There is no mention in the iOS 14 release notes for changes affecting keyboard extensions. Because of the differentiating results from iOS versions, I have no insight on what code to paste which may offer clues about what has caused this.

This question is open to those who may have insights or had experiences with iOS versions causing issues.

With the same codebase, on iOS 13, the rows of images show normally:

enter image description here

On the same device type with iOS 14, no images shows:

enter image description here

like image 284
daspianist Avatar asked Nov 03 '20 18:11

daspianist


1 Answers

As user @thedp helpfully pointed out in the comments to the question, this is indeed an UIImageView issue specific to iOS 14 that was not included in the release notes.

For easy browsing, here are the top resources I found:

  • iOS 14 issue causing GIFs to not show up
  • UIImageView masking bug (on Apple Developer forums, registration required)
  • UIImage not showing (also on Apple Developer forums)

And the resolution?

When the UIImage is initiated or being set, add:

layer.contentsScale = image.scale
layer.contents = image.cgImage

That was the resolution.

like image 74
daspianist Avatar answered Oct 18 '22 20:10

daspianist