【问题标题】:What causes this type of error. No visible @interface for xxxxxx. The root cause. Not just this one是什么导致了这种类型的错误。 xxxxxx 没有可见的@interface。根本原因。不只是这一个
【发布时间】:2018-05-12 14:12:55
【问题描述】:

我看到多年来有 869 个问题询问如何解决此错误。我试图理解的是这个消息的根本原因。 869 道题中的每道题都不一样。包括这个。我正在更新 Apple 资源 The AVCamera 代码中的一些代码,以便与 iOS11 一起使用。对象-c。 在这种情况下返回此错误的行是

[stillImageOutput setOutputSettings:outputSettings];

但是,我真正需要的是了解这个错误的根本原因是什么。不仅在这种情况下,而且在大多数情况下。 我第一次把这个项目放在一起是在2014年,当然从那以后更新了十几次,所以有很多Depreciated语句。我现在已经降到了 8 次折旧,但是我弹出了三个错误。这就是其中之一。两个 NO 可见接口,一个 No known 类。

        //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];
    }
});

【问题讨论】:

  • Apple 有时会像其他人一样更改 API。首先,他们将某些方法甚至类标记为已弃用:您仍然可以使用它们,但不建议这样做,因为最终(通常在几年内)已弃用的方法/类将被删除。如果您必须支持旧代码,则可以使用旧 SDK 或重构代码。

标签: ios xcode xcode9


【解决方案1】:

正如 Sergiy 的评论,被称为“NO visible interfaces”和 No known class 的方法已从 iOS 11 的 SDK 中删除。 苹果有时会做这些剧烈的改变。但通常这些方法和类首先被标记为已弃用,然后(在一些 iOS 主要更新之后)它们被删除。

【讨论】:

    【解决方案2】:

    好的,我了解 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];
        }
    });
    

    【讨论】:

      猜你喜欢
      • 2016-10-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-02-27
      相关资源
      最近更新 更多