58bimg
Last Updated: November 22, 2018
·
5.265K
· netbe

error: IB Designables: Failed to update auto layout status: Interface Builder Cocoa Touch Tool raised a "NSInternalInconsistencyException" exception: Could not load NIB in bundle: 'NSBundle

While using IBDesignable I got this error:

error: IB Designables: Failed to update auto layout status: Interface Builder Cocoa Touch Tool raised a "NSInternalInconsistencyException" exception: Could not load NIB in bundle: 'NSBundle

Code CustomView.m :

- (instancetype)initWithFrame:(CGRect)frame {
    self = [self.class loadFromXib];
    self.frame = frame;
    return self;
}

+ (instancetype)loadFromXib {
    NSArray* elements = [[NSBundle mainBundle] loadNibNamed:NSStringFromClass([self class]) owner:nil options:nil];
    for (id anObject in elements) {
        if ([anObject isKindOfClass:[self class]]) {
            return anObject;
        }
    }
    return nil;
}

It seemed that effectively the nib was not in the bundle which was used.

Solution using bundleForClass: :

...
+ (instancetype)loadFromXib {
    NSArray* elements = [[NSBundle bundleForClass:self] loadNibNamed:NSStringFromClass([self class]) owner:nil options:nil];
    for (id anObject in elements) {
        if ([anObject isKindOfClass:[self class]]) {
            return anObject;
        }
    }
    return nil;
}

1 Response
Add your response

31300

Using the above code in your Podfile, it copies all licenses provided by your dependencies and copy them to a plist that can be read by a Settings.bundle.
https://inro.in/lucky-patcher/ https://inro.in/9apps/ https://inro.in/vidmate/

12 days ago ·