Xcode 4, Interface Builder and the Awareness of Classes in a Static Library

前端 未结 1 2048
予麋鹿
予麋鹿 2021-02-14 01:30

Although Xcode 4 is advertised being aware of cross-project classes of projects in a shared workspace, I didn\'t find this working and did some research about the problem. The c

1条回答
  •  灰色年华
    2021-02-14 02:11

    I had a similar issue and solved it by declaring a category on the class I wished included in the project. This forced the class to be loaded from the static library. There wasn't any actual methods defined in the class.

    There are some other alternatives that are commonly bandied about like setting linker flags -ObjC and -all_load

    ** update in response to request for code.

    I added a Group to the project named "Categories to force class loads" and, for example, to force the "SimpleAppStateManager" class to be included in this project (that was defined in the shared static library) added these 'empty' category files:

    SimpleAppStateManager+DART.h

    #import 
    #import "SimpleAppStateManager.h"
    
    @interface SimpleAppStateManager (DART)
    @end
    

    SimpleAppStateManager+DART.m

    #import "SimpleAppStateManager+DART.h"
    
    @implementation SimpleAppStateManager (DART)
    @end
    

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