快速的问题。我有一个没有实现文件的类的项目。是否有编译器标志,以便链接器警告我这个? .h文件不带.m文件
然后在AppDelegate中我有:
#import "AppDelegate.h"
#import "SomeClass.h"
@interface AppDelegate()
@property (nonatomic, strong) SomeClass *myProperty;
@end
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[self.myProperty hello];
// self.myProperty = [[SomeClass alloc] init]; // uncomment and fails as expected.
return YES;
}
不应该有人告诉我,有没有实现文件?某种警告或任何事情?
如果我做了一个alloc] init],它不会按预期编译。
该代码实际编译。
这是github中的项目。
https://github.com/nmiyasato/noImplementation
由于
如果某个类没有实现,它将无法链接。警告通常是用于编译和链接的东西,但可能是错误的。 – dan
应该有一个扩展名为.a的库文件,或者应该有一些与之相关的SDK(框架)。 – Smile
该代码实际编译...我已经添加了一个示例项目。 – miya