Objective-C类别未加载 - 如何调试此 [英] Objective-C category is not loaded - How to debug this
问题描述
我有两个 RestKit框架的项目。
一个项目没有问题但是另一个项目失败了,只要使用RestKit框架。
One project works without problems but another project fails, as soon as the RestKit framework is used.
我发现失败的代码是这样:
I found out that the failing code is this:
return [anNSString MD5];
MD5
方法是一种类别方法,是这样导入的:
The MD5
method is a category method and is imported like this:
#import "NSString+MD5.h"
但是,在一个项目中,我一直收到以下错误:
However, in one project, I keep getting the following error:
-[__NSCFString MD5]: unrecognized selector sent to instance 0x88a3390
类别,并且他们可以在运行时加载,但我不明白为什么类别在这种情况下不加载。
I understand the basics of categories, and that they can be loaded at runtime, but I don't see why the category does not get loaded in this case.
这些是github上的文件: NSString + MD5.m , NSString + MD5。 h ,
These are the files on github: NSString+MD5.m, NSString+MD5.h,
推荐答案
确保您已启用-ObjC标志。或者它不会链接静态库中的类别。
Make sure you have the -ObjC flag enabled. Or it will not link categories in a static library.
这篇关于Objective-C类别未加载 - 如何调试此的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!