문제

I am trying to display an image in an UIImageView that i classed as PFImageView in the inspector and connected it to my detail controller.I am pulling the image from my Tableview array and sending it through prepare segue using

detailVC.image= [[Booksarray objectAtIndex:indexPath.row]objectForKey:@"BookImage"];

In detail controller i have two properties to help with this

@property (weak, nonatomic) IBOutlet PFImageView *BookImage;
@property (retain,nonatomic) PFFile * image;

and in the detail controller implementation i call them to display in view did load:

    BookImage.file=_image;
    [BookImage loadInBackground];

when I run the code though i get this error and my app crashes:

-[UIImageView setFile:]: unrecognized selector sent to instance 0xcb7bd70

도움이 되었습니까?

해결책

It seems that the PFImageView class may not be getting loaded properly so the incorrect class type is created (UIImageView).

As a workaround, add the code:

[PFImageView class];

somewhere in your app delegate / cell subclass + initialize to force the class to load.

Alternatives would be:

  1. -all_load -ObjC linker flags
  2. Calling any other method on the class anywhere before the cell is loaded from the storyboard / XIB
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top