【问题标题】:Debugging IBDesignable - debug selected views not working调试 IBDesignable - 调试不工作的选定视图
【发布时间】:2016-11-28 12:59:22
【问题描述】:

最近我制作了可重用的类,用于在界面视图中呈现IBDesignables xibs。

@interface ReusableView ()
@property (nonatomic, strong) UIView *contentView;
@end

@implementation ReusableView

- (instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    [self setupXib];

    return self;
}

- (instancetype)initWithCoder:(NSCoder *)aDecoder {
    self = [super initWithCoder:aDecoder];
    [self setupXib];

    return self;
}

- (void)setupXib {
    self.contentView = [self loadFromNib];

    self.contentView.frame = self.bounds;
    self.contentView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;

    [self addSubview:self.contentView];
}

- (UIView *)loadFromNib {
    NSBundle *bundle = [NSBundle bundleForClass: [self class]];
    UINib *nib = [UINib nibWithNibName:NSStringFromClass([self class]) bundle:bundle];
    UIView *view = (UIView *)[[nib instantiateWithOwner:self options:nil] firstObject];

    return view;
}

@end

到目前为止一切正常,直到今天。我的代码几乎没有任何改变(我什至回滚到 master 分支以确保)并且我使用此类的 xib 不再在情节提要中呈现。

在界面生成器中有信息

Designables:构建失败

但显示按钮什么也不做,并且尝试使用编辑器>调试选定视图。我无法在课堂上遇到任何断点。

到目前为止我尝试过:

  • 清理派生数据
  • 重新启动 x 代码
  • 杀死Interface Builder Cocoa Touch Tool
  • 完全重启
  • 项目清理(在前面描述的操作之间)

这是某种 xcode 错误还是我的错?除了Debug Selected Views 选项之外,是否可以通过其他方式调试 Designables?

【问题讨论】:

  • 你知道怎么做吗?不,这可能不是你的错。 Xcode 就是一坨屎。
  • 我遇到同样的问题已经有一段时间了。迄今为止我发现的唯一解决方案是删除 xib 文件的内容并重新创建它们。就我而言,其中一个 xib 文件中有一个特定的标签,通常是罪魁祸首。除了费力的手动测试之外,我不知道它为什么会损坏,或者如何确定问题出在哪个 xib 文件中,更不用说应该归咎于哪个视图了。这是非常令人沮丧的。

标签: ios objective-c xcode cocoa-touch ibdesignable


【解决方案1】:

如果您单击“显示报告导航器”然后查看接口构建部分,Xcode 现在会显示 IB 构建错误。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-01-02
    • 1970-01-01
    • 2015-06-19
    • 1970-01-01
    • 2014-11-01
    • 2012-06-23
    相关资源
    最近更新 更多