Categories in static library for iPhone device 3.0

强颜欢笑 提交于 2019-11-27 08:45:47

We ran into the same problem (under 3.0, -ObjC no longer links in categories) within the Core Plot framework. All I can say is that for us, we were able to add the -all_load option to the Other Linker Flags within the target application and that did away with the runtime errors. We didn't see any warnings for duplicate symbols.

I've filed a bug report for the linker behavior, as I'm sure others have.

jamie

Its a bug caused by trying to fix another bug with a hack. The -all_load fix for the category bug is a total hack.

See here for more.

When you add -all_load to your other linker flags, make sure, all frameworks, the library uses are linked with your target app. Otherwise, it will fail to compile. In my case, I had a Category for MKMapView and did not bind the MapKit Framework with my target app, thus the class which the category belongs to wasn't found at build time.

Kenny Leung

I ran into the same "duplicate symbols" problem. Without the -all_load flag, we had to also include all libraries our library linked against in the app link line. Removing these from the app link line solved the issue.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!