1
所以我有这样一个单:为X无可见@interface宣布选择Y于一个单身
#import "SCAppManager.h"
@implementation SCAppManager
+ (instancetype)sharedApplication {
static SCAppManager *sharedApplication = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
if (sharedApplication == nil) {
sharedApplication = [[SCAppManager alloc] init];
}
});
return sharedApplication;
}
+ (void)test {
NSLog(@"test");
}
@end
而且它的接口是这样的:
#import <Foundation/Foundation.h>
@interface SCAppManager : NSObject
+ (instancetype)sharedApplication;
+ (void)test;
@end
但是,当尝试使用在[[SCAppManager sharedApplication] test];
在ViewController中,我得到的错误:
No visible @interface for 'SCAppManager' declares the selector 'test'
我已经看所有的可能性,我已经IM移植我的singleton类correclty并在公共接口中声明我的方法。我也在这里搜索了一些答案,但所有的修补程序都不适合我。
有没有人遇到过这个问题? 谢谢!
我很困惑与其他事情,我错过了。非常感谢你,@ midhun-mp! –
@ GabrielOliva:不客气。快乐编码! –