我有一个名为的类VideoListViewController
,它是一个抽象类(即仅用于子类化)。现在我想在ShareViewController
和中扩展它MyVideosViewController
。例如,在Python中,
class VideoListViewController (UIViewController):
# implementation
class ShareViewController (VideoListViewController):
# implementation
class MyVideosViewController (VideoListViewController):
# implementation
我所拥有的是:
// VideoListViewController.h
@interface VideoListViewController : UIViewController
// interface declaration
@end
// ShareViewController.h
#import "VideoListViewController.h"
@interface ShareViewController : VideoListViewController
// ^ this line shows an error
// interface declaration
@end
但这不会编译(Cannot find interface declaration for 'VideoListViewController', superclass of 'ShareViewController'
)。
我该如何解决?
如果“ VideoListViewController”类未编译且本身具有错误,因此无法由其他类扩展,则可能会发生这种情况。尝试以下-
// VideoListViewController.h
#import <UIKit/UIKit.h>
@interface VideoListViewController : UIViewController
@end
3.检查“ VideoListViewController.m”是否包含在目标成员资格中。要检查这一点,请在导航器中选择VideoListViewController.m文件,然后打开文件检查器。在“目标成员身份”下,应检查您要建立的目标。如果没有检查。在创建提供此选项的文件时,您可能已经忘记了这一点。
4.这可能是循环引用的问题。确保您在超类中没有任何子类的头文件。就像VideoListViewController.h中的#import ShareViewController.h一样。如果有的话,也请重新查看任何@class引用。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句