是什么导致了这种类型的错误。 xxxxxx没有可见的@interface。根本原因。不只是这个

时间:2018-05-12 14:12:55

标签: ios xcode xcode9

我看到有869个问题多年来一直在询问如何修复此错误。我想要了解的是这条消息的根本原因。 869个问题中的每一个都是不同的。包括这一个。我正在更新Apple的Resources The AVCamera 代码中的一些代码,以便与iOS11一起使用。 OBJ-C。 在这种情况下返回此错误的行是

  

[stillImageOutput setOutputSettings:outputSettings];

然而,我真正需要的是是要了解这个错误的根本原因是什么。不只是在这种情况下,但大多数情况下。 我在2014年首次将这个项目放在一起,当然,从那时起已有十几个更新,所以有很多折旧的陈述。我现在已经减少了8次折旧,但我弹出了三个错误。这是其中之一。两个NO可见接口,一个没有已知类。

        //AVCaptureStillImageOutput *stillImageOutput = [[AVCaptureStillImageOutput alloc] init];
    AVCapturePhotoOutput *stillImageOutput = [[AVCapturePhotoOutput alloc] init];
    if ([session canAddOutput:stillImageOutput])
    {
       // [stillImageOutput setOutputSettings:@{AVVideoCodecKey : AVVideoCodecTypeJPEG}];
        NSDictionary *outputSettings = @{ AVVideoCodecKey : AVVideoCodecTypeJPEG};
        [stillImageOutput setOutputSettings:outputSettings];

        [session addOutput:stillImageOutput];
        [self setStillImageOutput:stillImageOutput];
    }
});

2 个答案:

答案 0 :(得分:0)

与Sergiy的评论一样,这个被称为“NO visible interfaces”的方法和iOS 11的SDK中没有已知类。 Apple有时会做出这些剧烈的变化。但通常这些方法和类被标记为已弃用,首先(在一些iOS主要更新之后)它们被删除。

答案 1 :(得分:0)

好的,我了解Apple决定背后的情况。至于上面的代码,我只是通过将代码更改为此来解决它。冗余代码被注释掉,并插入新代码。

但是,“没有可见界面”的根本问题对我来说仍然是一个谜。究竟是什么意思?

        //AVCaptureStillImageOutput *stillImageOutput = [[AVCaptureStillImageOutput alloc] init];
    AVCapturePhotoOutput *stillImageOutput = [[AVCapturePhotoOutput alloc] init];
    if ([self.session canAddOutput:stillImageOutput])
    {
        [self.session addOutput:stillImageOutput];
        self.stillImageOutput = stillImageOutput;

       // [stillImageOutput setOutputSettings:@{AVVideoCodecKey : AVVideoCodecTypeJPEG}];
       // NSDictionary *outputSettings = @{ AVVideoCodecKey : AVVideoCodecTypeJPEG};
       // [stillImageOutput setOutputSettings:outputSettings];

        //[session addOutput:stillImageOutput];
        //[self setStillImageOutput:stillImageOutput];
    }
});