3
votes

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?

3
That sounds as if PFImageView.m hasn't been added to the target ("Target Membership" checkbox in the File inspector). - Martin R
The pfimage is apart of a framework. That framework is added to the target and all of its other features work. - Atma
OK, I just noticed that you get exactly this error message if you set a custom class for an object in Interface Builder and the class is not available at runtime because the .m file has not been added to the target. - Martin R
@Atma did you find a solution? - Kyle Clegg

3 Answers

6
votes

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

1
votes

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.

0
votes

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