0

I have an application and I continue to get the log output: "Unknown class ingredientLabel in Interface Builder File." ...when I load a specific view.

The ingredientLabel is a label I created in the view. Here is the relevant code:

in DetailViewController.h:

@interface QuickGroceryDetailViewController : UIViewController
{
    UILabel *ingredientLabel;
}

@property (strong, nonatomic) IBOutlet UILabel *ingredientLabel;

in DetailViewController.m:

@synthesize ingredientLabel = _detailDescriptionLabel;

- (void)setDetailItem:(id)newDetailItem
{
    if (_detailItem != newDetailItem) {
        _detailItem = newDetailItem;

        // Update the view.
        [self configureView];
    }
}

- (void)configureView
{
    // Update the user interface for the detail item.

    if (self.detailItem) {
        self.ingredientLabel.text = [self.detailItem description];
    }

}

No error occurs, and the app runs fine, but I wanted to know why this error is occurring as it could cause problems down the line. Thank you.

user1072337
  • 12,615
  • 37
  • 116
  • 195

1 Answers1

0

Check if you have written something in the custom class attribute of that label.

  1. Open the xib where the label is
  2. Go to Identity inspector (CMD + ALT + 3)
  3. Check the custom class textfield, it there is something just delete it and UILabel will be reestablished
  4. Run the code... That line appears when the loadNib,initWithNib, etc. is executed.
LightMan
  • 3,517
  • 31
  • 31