Supported orientations has no common orientation with the application, and [UIAlertController should

Supported orientations has no common orientation with the application, and [UIAlertController shouldAutorotate] is returning YES

解决方法

//

#import "UIAlertController+FixCrash.h"

@implementation UIAlertController (FixCrash)

+ (void)load
{
    Class vc = NSClassFromString(@"UIAlertController");
    SEL originalSelector = @selector(shouldAutorotate);
    SEL swizzledSelector = @selector(fixCrashReturn);
    Method originalMethod = class_getInstanceMethod(vc, originalSelector);
    Method swizzledMethod = class_getInstanceMethod([self class], swizzledSelector);
    BOOL didAddMethod = class_addMethod(vc,originalSelector,method_getImplementation(swizzledMethod),method_getTypeEncoding(swizzledMethod));
    if(didAddMethod) {
        class_replaceMethod([self class],swizzledSelector,method_getImplementation(originalMethod),method_getTypeEncoding(originalMethod));
    } else {
        method_exchangeImplementations(originalMethod, swizzledMethod);
    }
}

- (BOOL)fixCrashReturn{
    return NO;
}

@end

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
uniapp中的元素没有支持的资源。 在使用uniapp开发过程中,当我们使用某个元素时,如果该元素所需的资源无法找到或不被支持,就会出现"the element has no supported sources"的错误。 这个错误通常出现在引入某个组件或插件时,由于缺少所需的资源文件或资源文件与组件不兼容,导致无法正确加载该元素。解决这个问题可以尝试以下几种方法: 1. 检查资源文件路径:首先确认所需资源文件的路径是否正确。确保资源文件与组件的引用路径一致,可以使用相对路径或绝对路径。 2. 检查资源文件格式:确定资源文件格式是否与组件要求一致。有时候资源文件的格式有特定要求,如图片要求使用特定的格式(如jpg或png),音频要求使用特定的编码格式等。 3. 检查组件版本:如果使用的是第三方组件或插件,可能是因为组件版本不兼容导致的。尝试更新组件到最新版本或查看组件的官方文档,了解是否存在已知的资源兼容性问题。 4. 检查运行环境:uniapp可以在多个平台上运行,如小程序、App、H5等。确保资源文件在当前运行环境中可用,有时候某个平台可能不支持某种资源文件格式或功能。 5. 查看错误日志:如果以上方法都没有解决问题,可以尝试查看uniapp的错误日志,获取更详细的错误信息,有助于定位和解决问题。 总结:在uniapp中,出现"the element has no supported sources"的错误是因为某个元素的资源无法找到或不被支持。通过检查资源文件路径、格式、组件版本、运行环境以及错误日志,可以解决这个问题。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值