Calling method on category included from iPhone static library causes NSInvalidArgumentException

前端 未结 9 704
粉色の甜心
粉色の甜心 2020-12-04 10:36

I have created a static library to house some of my code like categories.

I have a category for UIViews in \"UIView-Extensions.h\" named Extensions.

In this

9条回答
  •  借酒劲吻你
    2020-12-04 11:23

    I had the same problem with Categories in my static library. In my case, "-all_load" didn't help as it caused loads of build errors (my static library is a wrapper around another private C/C++ lib).

    I solved it by a hack suggested at http://iphonedevelopmentexperiences.blogspot.com/2010/03/categories-in-static-library.html which simply involved adding a dummy (empty) class definition to the category files. Using this hack, I kept "-ObjC" but dropped "-all_load" in the application linker settings and it worked fine on the device.

提交回复
热议问题