Closed cquxutao closed 7 years ago
参考资料:https://github.com/Cocoanetics/DTCoreText/issues/169
解释1: For 64-bit and iPhone OS applications, there is a linker bug that prevents -ObjC from loading objects files from static libraries that contain only categories and no classes. The workaround is to use the -all_load or -force_load flags. 解释2: The -ObjC option is broken in some versions of the linker. For those cases the -force_load and -all_load options work.
具体的例子我没有验证过,也许这个 Bug 修复了,也许是你的 Demo 有问题。我的建议是不要太纠结,先用 -ObjC 试试,不行再用 -force_load
暂时先关掉 issue,后续如果还有问题可以再开。
博客中描述:然而根据文档描述,如果静态库只有分类,而没有类, 即使加了 -ObjC 选项也会报错,应该使用 -force_load 参数。
作了个实验,一个只包含NSobject分类的静态库,添加-ObjC选项可以正常运行起来