文章标题warning: could not load any Objective-C class information. This will significantly reduce the qu

本文探讨了iOS应用中因布局子视图时修改自身frame导致的死循环问题。通过分析原因并提供解决方案,帮助开发者避免此类错误。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

首先这个问题翻译一下

警告说无法加载任何OC类

遇到这个问题,我的模拟器运行是好的,真机6s是没问题的,但在5上就报这个错,所以没有关注代码的问题。但在网上查阅资料,发现这个问题的关键就是 死循环 ! 。可能是递归没有出口这类问题,而我的这个问题是在layoutSubViews 中改变了 自己的frame 这样改变的同时会掉用 layoutSubViews,layoutSubViews中又会改变frame 所以是一个死循环。

所以解决这个bug的重点就是给这个循环找个出口!

但我还是不知道 ,为什么我在模拟器和真机6s中是ok的。而在5上不行。可能是版本问题,6s 系统9.2的,而5是 9.02的,当然也有可能是 真机的底层架构模式不同!


- (void)layoutSubviews {
    [super layoutSubviews];
//    self.width += 13; 就是这个地方
    [self mas_makeConstraints:^(MASConstraintMaker *make) {
        make.width.mas_equalTo(WidthScale(30)+13);
    }];
    for (UIView *view in self.subviews) {
        if ([view isKindOfClass:[UILabel class]]) {
            [view mas_makeConstraints:^(MASConstraintMaker *make) {
                make.leading.mas_equalTo(self);
                make.centerY.mas_equalTo(self);
            }];
        }
        if ([view isKindOfClass:[UIImageView class]]) {
            [view mas_makeConstraints:^(MASConstraintMaker *make) {
                make.trailing.mas_equalTo(self);
                make.centerY.mas_equalTo(self);
                make.height.mas_equalTo(15);
                make.width.mas_equalTo(13);
            }];
        }
    }
}
解释这些参数optional arguments: -h, --help show this help message and exit --host HOST --port PORT --config-installer Open config web page, mainly for windows installer (default: False) --load-installer-config Load all cmd args from installer config file (default: False) --installer-config INSTALLER_CONFIG Config file for windows installer (default: None) --model {lama,ldm,zits,mat,fcf,sd1.5,cv2,manga,sd2,paint_by_example,instruct_pix2pix} --no-half Using full precision model. If your generate result is always black or green, use this argument. (sd/paint_by_exmaple) (default: False) --cpu-offload Offloads all models to CPU, significantly reducing vRAM usage. (sd/paint_by_example) (default: False) --disable-nsfw Disable NSFW checker. (sd/paint_by_example) (default: False) --sd-cpu-textencoder Run Stable Diffusion text encoder model on CPU to save GPU memory. (default: False) --local-files-only Use local files only, not connect to Hugging Face server. (sd/paint_by_example) (default: False) --enable-xformers Enable xFormers optimizations. Requires xformers package has been installed. See: https://github.com/facebookresearch/xformers (sd/paint_by_example) (default: False) --device {cuda,cpu,mps} --gui Launch Lama Cleaner as desktop app (default: False) --no-gui-auto-close Prevent backend auto close after the GUI window closed. (default: False) --gui-size GUI_SIZE GUI_SIZE Set window size for GUI (default: [1600, 1000]) --input INPUT If input is image, it will be loaded by default. If input is directory, you can browse and select image in file manager. (default: None) --output-dir OUTPUT_DIR Result images will be saved to output directory automatically without confirmation. (default: None) --model-dir MODEL_DIR Model download directory (by setting XDG_CACHE_HOME environment variable), by default model downloaded to ~/.cache (default: /Users/cwq/.cache) --disable-model-switch Disable model switch in frontend (default: False)
06-09
这是一些可选参数,可以在命令行中使用来配置运行环境和模型选择等。下面是每个参数的解释: - -h, --help:显示帮助信息并退出。 - --host HOST:设置服务器主机地址。 - --port PORT:设置服务器端口号。 - --config-installer:打开配置页面,主要用于Windows安装程序(默认值为False)。 - --load-installer-config:从安装程序配置文件中加载所有命令参数(默认值为False)。 - --installer-config INSTALLER_CONFIG:Windows安装程序的配置文件路径(默认值为None)。 - --model {lama,ldm,zits,mat,fcf,sd1.5,cv2,manga,sd2,paint_by_example,instruct_pix2pix}:选择要使用的模型。 - --no-half:使用完整精度模型。如果生成的结果总是黑色或绿色,请使用此参数(仅适用于sd/paint_by_exmaple模型)(默认值为False)。 - --cpu-offload:将所有模型卸载到CPU上,大大减少vRAM的使用(仅适用于sd/paint_by_example模型)(默认值为False)。 - --disable-nsfw:禁用NSFW检查器(仅适用于sd/paint_by_example模型)(默认值为False)。 - --sd-cpu-textencoder:在CPU上运行稳定扩散文本编码器模型以节省GPU内存(默认值为False)。 - --local-files-only:仅使用本地文件,不连接到Hugging Face服务器(仅适用于sd/paint_by_example模型)(默认值为False)。 - --enable-xformers:启用xFormers优化。需要安装xformers软件包。请参见:https://github.com/facebookresearch/xformers(默认值为False)。 - --device {cuda,cpu,mps}:选择使用的设备(默认值为cuda)。 - --gui:将Lama Cleaner作为桌面应用程序启动(默认值为False)。 - --no-gui-auto-close:在GUI窗口关闭后防止后端自动关闭(默认值为False)。 - --gui-size GUI_SIZE GUI_SIZE:设置GUI窗口的大小(默认值为[1600,1000])。 - --input INPUT:如果输入为图像,则默认加载图像。如果输入为目录,则可以在文件管理器中浏览并选择图像(默认值为None)。 - --output-dir OUTPUT_DIR:自动将结果图像保存到输出目录,无需确认(默认值为None)。 - --model-dir MODEL_DIR:模型下载目录(通过设置XDG_CACHE_HOME环境变量),默认情况下模型下载到~/.cache(默认值为/Users/cwq/.cache)。 - --disable-model-switch:禁用前端的模型切换功能(默认值为False)。
评论 5
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值