首页 > 解决方案 > 'YVideoView' 不可用:在 iOS(应用扩展)上不可用 - 渲染在应用扩展中不可用

问题描述

我有一个导入XYVideoPlayer.framework. 在 XYVideoPlayer.framework 项目中, 代码片段VideoViewController.h就像

#import <UIKit/UIKit.h>
#pragma once

@interface VideoViewController : UIViewController {
@public
#if ! TARGET_IPHONE_SIMULATOR
    IBOutlet XVideoView *video_view;
#else
    IBOutlet YVideoView *video_view;
#endif
    IBOutlet UIView *video_container_view;
}

&中的代码片段YVideoView.h就像

#import <UIKit/UIKit.h>
#import "VideoRenderer.h"

NS_ASSUME_NONNULL_BEGIN

@class YVideoView;
RTC_OBJC_EXPORT
NS_EXTENSION_UNAVAILABLE_IOS("Rendering not available in app extensions.")
@interface YVideoView : UIView <VideoRenderer>

@end

NS_ASSUME_NONNULL_END

现在的问题是,当我import XYVideoPlayer在我的主项目中尝试构建时。iPhone 中没有构建错误,但在模拟器中,构建因错误 “YVideoView”而失败不可用:在 iOS (App Extension) 上不可用 - 渲染在应用扩展中不可用。知道如何修复 xcode 模拟器的构建错误吗?

标签: iosobjective-cswiftxcodeuiviewcontroller

解决方案


推荐阅读