You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@weex.apache.org by GitBox <gi...@apache.org> on 2020/12/29 07:29:42 UTC

[GitHub] [incubator-weex] dorentus commented on pull request #3268: [iOS] 修复使用 Xcode 12 构建且运行在 iOS 14 上时图片不加载的问题

dorentus commented on pull request #3268:
URL: https://github.com/apache/incubator-weex/pull/3268#issuecomment-751980221


   我这边使用 https://github.com/apache/incubator-weex/pull/3276 之后还是会遇到图片不显示的问题,不是所有图片,是随机的部分图片显示不出来。调试显示对应的 `WXImageView` 的 `image` 属性是有值的。
   
   现在是用了这样的方式绕过的:
   
   ```diff
   diff --git a/ios/sdk/WeexSDK/Sources/Component/WXImageComponent.m b/ios/sdk/WeexSDK/Sources/Component/WXImageComponent.m
   index 628033fbe541cf4b9506d4279ad99615e0d616fc..2f02c2580aafd66f81a2cf3001d1e09dc1fe0838 100644
   --- a/ios/sdk/WeexSDK/Sources/Component/WXImageComponent.m
   +++ b/ios/sdk/WeexSDK/Sources/Component/WXImageComponent.m
   @@ -35,6 +35,26 @@
    #import <pthread/pthread.h>
    #import "WXMonitor.h"
    #import "WXSDKInstance_performance.h"
   +#import <objc/message.h>
   +
   +@interface WXImageLayer : WXLayer
   +
   +@end
   +
   +@implementation WXImageLayer
   +
   +- (void)display
   +{
   +    if (@available(iOS 14.0, *)) {
   +        // call -[CALayer display]
   +        struct objc_super s = {.receiver = self, .super_class = self.superclass.superclass};
   +        ((void (*)(struct objc_super *, SEL))objc_msgSendSuper)(&s, _cmd);
   +    }
   +
   +    [super display];
   +}
   +
   +@end
    
    @interface WXImageView : UIImageView
    
   @@ -44,7 +64,7 @@
    
    + (Class)layerClass
    {
   -    return [WXLayer class];
   +    return [WXImageLayer class];
    }
    
    @end
   ```
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org