iphone - “没有用于选择器“方法名称”的已知类方法”,但是我的代码是正确的

标签 iphone ios class

没有已知的选择器“注销”的类方法

但是我尝试用相同的代码创建一个新项目,这是可行的!

为什么?

有人可以回答我吗?

LoginController.h

//
//  LoginController.h
//
#import <Foundation/Foundation.h>

@interface LoginController : NSObject
+(void)Logout;

@end
LoginController.m
//
//  LoginController.m
//

#import "LoginController.h"

@implementation LoginController
+(void)Logout{
    //something here
}
@end
HomeViewController.m
//
//  HomeViewController.m
//
#import "LoginController.h"
@interface HomeViewController ()

@end
HomeViewController.m
@implementation HomeViewController

- (void)viewDidLoad
{

    [LoginController Logout];

}
@end

最佳答案

您可能没有在#import "LoginController.h"中添加HomeViewController.m,因此编译器不知道此方法。看起来您确实将其包括在.h中,但是您可能没有在#import "HomeViewController.h中包括“HomeViewController.m

关于iphone - “没有用于选择器“方法名称”的已知类方法”,但是我的代码是正确的,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19295366/

相关文章:

iphone - 为什么我的 UITableView 在初始化时似乎没有以编辑 = YES 模式启动?

ios - 检查 string == "(any of multiple strings)"{} 的最佳方法

android - Ionic Framework Build for IOS on El Capitan - 构建错误(GCC?)

c++ - 嵌套类变量调用

ios - 如何在 Swift 中临时存储图像和字符串?

ios - 如何识别以前安装在 iOS 设备中的应用程序?

iphone - 如何更改标签栏项目的图标?

ios - ScrollView - 手势识别器 - 垂直滑动

ios - UIScrollView 不滚动 - 内容大小不明确

Matlab:静态类成员