Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 449
Atma Avatar asked Dec 05 '25 19:12

Atma


2 Answers

"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!!:)

like image 184
gustav Avatar answered Dec 08 '25 08:12

gustav


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.

like image 29
Kyle Clegg Avatar answered Dec 08 '25 09:12

Kyle Clegg



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!