美文网首页
使用class_addMethod方法需要导入什么

使用class_addMethod方法需要导入什么

作者: 温柔的熊 | 来源:发表于2018-07-30 15:35 被阅读0次

  如果在oc文件中直接使用class_addMethod方法会报这个错误,Declaration of 'class_addMethod' must be imported from module 'ObjectiveC.runtime' before it is required。

但是,发现并没有ObjectiveC.runtime这样的文件,所以无法import。

后来发现,#import <objc/runtime.h>,添加这行代码就能使用class_addMethod;

相关文章

网友评论

      本文标题:使用class_addMethod方法需要导入什么

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