美文网首页
iOS NSObjCRuntime错误解析

iOS NSObjCRuntime错误解析

作者: 零下十一度 | 来源:发表于2019-07-12 15:34 被阅读0次

[Xcode]非Objc文件(c, c++)引起的NSObjCRuntime错误解析
1.以下是错误示例

#if DEBUG

#define NSLog(FORMAT, ...) fprintf(stderr,"[%s:%d行] %s\n",[[[NSString stringWithUTF8String:__FILE__] lastPathComponent] UTF8String],   __LINE__, [[NSString stringWithFormat:FORMAT, ### #__VA_ARGS__] UTF8String]);

#else

#define NSLog(FORMAT, ...) nil

#import <Masonry.h>

#import "UIViewExt.h"

#endif

2.正确顺序


#import <Masonry.h>

#import "UIViewExt.h"

#if DEBUG

#define NSLog(FORMAT, ...) fprintf(stderr,"[%s:%d行] %s\n",[[[NSString stringWithUTF8String:__FILE__] lastPathComponent] UTF8String], __LINE__, [[NSString stringWithFormat:FORMAT, ### #__VA_ARGS__] UTF8String]);

#else

#define NSLog(FORMAT, ...) nil

#endif

今天在objc工程中,导入一些c、c++文件时,,编译引起了NSObjCRuntime错误,,,仔细检查发现,
原来是在*.pch中,用上边错误的写法。调整顺序就可以正常编译了

相关文章

网友评论

      本文标题:iOS NSObjCRuntime错误解析

      本文链接:https://www.haomeiwen.com/subject/pexykctx.html