Atma
Atma

Reputation: 29805

receiving error Unknown class PFImageView in Interface Builder file for parse

I attempted to setup pfimage view storyboards in the following manner:

I dragged a UIImageView and then changed its class identity to PFImageView.

Then I dragged it to create an outlet in my .h file.

@property (strong, nonatomic) IBOutlet PFImageView *BuyPetImage;

Then on my on load for the class I access imageview with the same name as the property and set its file property.

- (void)viewDidLoad {
    [super viewDidLoad];

    // Do any additional setup after loading the view.
    PFObject *petdataobj = [selectedPet objectForKey:@"petObject"];
    self.BuyPetNameLabel.text = [petdataobj objectForKey:@"Name"];
    self.BuyPetTypeLabel.text = [petdataobj objectForKey:@"Type"];

    self.BuyPetImage.file= [selectedPet objectForKey:@"imageFile"];
    [self.BuyPetImage loadInBackground];
}

When the view loads I get the following error:

Unknown class PFImageView in Interface Builder file. -[UIImageView setFile:]: unrecognized selector sent to instance 0x1cdb52f0 * Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIImageView setFile:]: unrecognized selector sent to instance 0x1cdb52f0'

Does anyone know why this is happening?

Upvotes: 3

Views: 2053

Answers (3)

Klipnov
Klipnov

Reputation: 105

If I alloc init PFImageView in the .m file it works without adding [PFImageView class]; in appDelegate

Upvotes: 0

gustav
gustav

Reputation: 61

"Unknown class PFImageView in Interface Builder file"

Adding the following to applicationDidLaunch in your AppDelegate forces the view class to load so it may be referenced correctly

//In AppDelegate / applicationDidLaunch add:

[PFImageView class];

//Pictures loads perfectly now!!:)

Upvotes: 6

Kyle Clegg
Kyle Clegg

Reputation: 39480

I couldn't get around this problem so I ended up just creating the PFImageView entirely in code. There's a couple examples of this in the Anypic project. I would like to figure out the cause of this problem and how to resolve it, but for now doing it in code allows me to get around it.

Upvotes: 1

Related Questions