문제

My app crashes in the debug mode if I run this line of code:

[brightnessFilter forceProcessingAtSize:imgView2.sizeInPixels];

This is the whole code:

UIImage *inputImage = imgView.image;

sourcePicture = [[GPUImagePicture alloc] initWithImage:inputImage smoothlyScaleOutput:YES];
brightnessFilter = [[GPUImageBrightnessFilter alloc] init];
//    sepiaFilter = [[GPUImageSobelEdgeDetectionFilter alloc] init];

GPUImageView *imgView2 = (GPUImageView *)self.view;
[brightnessFilter forceProcessingAtSize:imgView2.sizeInPixels];

[sourcePicture addTarget:brightnessFilter];
[brightnessFilter addTarget:imgView2];

[sourcePicture processImage];

This is the log:

2014-05-13 16:04:46.671 Picxxr[5341:60b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIView sizeInPixels]: unrecognized selector sent to instance 0x109fbed60'

My imgView:

imgView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 64, 320, 320)];
[self.view addSubview:imgView];
도움이 되었습니까?

해결책

The code you shared is probably inside the implementation file of one of your UIViewController's which I'm sure has an associated .xib or lies somewhere inside a storyboard.

Now take that UIViewController, select the root view (the white background of the view controller) and change its class from UIView to GPUImageView as shown here.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top