Interface Builder can't see classes in a static library

前端 未结 4 787
甜味超标
甜味超标 2020-12-28 19:31

I have refactored some UIView sub-classes into a static library. However, when using Interface Builder to create view components for a project that uses the static library I

相关标签:
4条回答
  • 2020-12-28 20:12

    Add the same problem as LexH. It worked only when I called a dummy class method. The problem was that I did not add my static library to the "link binary with libraries" under target. Strangely everything else worked.

    I followed this guide to link with my static lib Create static lib

    0 讨论(0)
  • 2020-12-28 20:23

    Try dragging the static library into your xib browser in Interface Builder. I haven't tried this with a static library, but the concept is the same. When you drag header files into IB, you can access those classes.

    0 讨论(0)
  • 2020-12-28 20:27

    I had the same problem. Dragging the library or headers to XIB Browser didn't work. Read Class Files didn't work. So I called:

    [MyLibraryClass version];    // Substitute your class name for "MyLibraryClass".
    

    This worked. version is a class method of NSObject, so all subclasses of NSObject inherit it.

    0 讨论(0)
  • 2020-12-28 20:32

    LexH, try linking with the -ObjC flag when building your static library. That worked for me... for about a year :-) I found this post as the problem has returned with a fresh OSX install and an upgrade in xcode. But it worked in XCode 3.1.2.

    • David
    0 讨论(0)
提交回复
热议问题