[ios]断言失败-[GPUImageFilter initWithVertexShaderFromString:]

发布时间: 2016/5/9 2:00:58
注意事项: 本文中文内容可能为机器翻译,如要查看英文原文请点击上面连接.

得到如下错误

断言失败-[GPUImageFilter initWithVertexShaderFromString:fragmentShaderFromString:],/Users/XYZ/Downloads/GPUImage-master/framework/Source/GPUImageFilter.m:94

我已经设置根据在https://github.com/BradLarson/GPUImage中提及后设置框架路径和其他所有的事情写是因为测试而得到错误上面几行代码之后。

GPUImageVideoCamera *videoCamera = [[GPUImageVideoCamera alloc] initWithSessionPreset:AVCaptureSessionPreset640x480 cameraPosition:AVCaptureDevicePositionBack];
videoCamera.outputImageOrientation = UIInterfaceOrientationPortrait;

GPUImageFilter *customFilter = [[GPUImageFilter alloc] initWithFragmentShaderFromFile:@"CustomShader"];
GPUImageView *filteredVideoView = [[GPUImageView alloc] initWithFrame:CGRectMake(0.0, 0.0, viewWidth, viewHeight)];

// Add the view somewhere so it's visible

[videoCamera addTarget:customFilter];
[customFilter addTarget:filteredVideoView];

[videoCamera startCameraCapture];

请帮我解决这个问题......

解决方法 1:

NSAssert(NO, @"Filter shader link failed");

您的链接"CustomShader"是错误的。你有 CustomShader.fsh 在您的项目?

官方微信
官方QQ群
31647020