9
votes

I am using JSQMessageViewController and I am facing the issue (only in ios14) that i cant see media items like Images, Video and Audio in device though these views are generating debug view hierarchy. See below attached image:-

debug view hierarchy screenshot:

enter image description here

here is the description of UIImage inside collection view cell: <UIImageView: 0x7fe7d6d95b30; frame = (20 8; 177 131); clipsToBounds = YES; opaque = NO; autoresize = RM+BM; userInteractionEnabled = NO; layer = <CALayer: 0x600001ce4ec0>>

here is the screenshot attached of screen:

enter image description here

You can see the view has generated space for image, but its not showing up!

Is anyone facing this issue? how can i solve this problem. This issue is occurring in iOS 14, it works perfectly in iOS 13.

2
JSQMessageViewController hasn't been updated for more than 4 years and is no longer supported. Maybe you can try MessageKit instead: github.com/MessageKit/MessageKitkoen

2 Answers

22
votes

You need to overwrite in JSQMessagesMediaViewBubbleImageMasker.m
method - (void)jsq_maskView:(UIView *)view withImage:(UIImage *)image and change line:

view.layer.mask = imageViewMask.layer;

to be

view.maskView = imageViewMask;

I suggest you to use category for that. For me that was solution.

3
votes

I would like to suggest to change like as follows along with the Vladimir answer for backward compatibility:

if (@available(iOS 14.0, *)) {
    view.maskView = imageViewMask;
} else {
    view.layer.mask = imageViewMask.layer;
}