Can you reference Xib files from static libraries on the iPhone?

前端 未结 6 1750
清酒与你
清酒与你 2020-11-28 06:27

In my app, i currently have all my code separated into a static library, to make it easier to set up the xcode project targets for the actual app and for unit tests for my c

6条回答
  •  日久生厌
    2020-11-28 07:21

    Reply to comment (won't fit in comment box)

    No worries, I've been trying to do pretty much the same thing as you for the last week - I'd like to ship a "framework" of xibs, include files and .a libs to a client without giving them all the source code. I couldn't find a good way to do this with bundles either.

    For whatever reason, Apple are being particularly obtuse about this - I can't see a reason for them to be so in the case of static libraries (dynamic libraries fair enough).

    My solution for now is to manually create a package folder "Foo" that contains the following subfolders:

    1. "include" -> put .h files here
    2. "res" -> put .xib files here
    3. "lib" -> contains "iphoneos" & "iphonesimulator" subfolders each with libFoo.a

    Then zip this up and send to the client. The client then:

    1. Unzips the package where ever they like.
    2. Adds the "res" folder under the resources group.
    3. Changes the following target settings:
      Other Linker Flags = -Objc -lfoo
      Header Search Paths = /include
      Library Search Paths = /lib/$(PLATFORM_NAME)

    I can probably automate the package creation with some build steps at my end, but the client is stuck with four slightly fiddly steps to get set up.

提交回复
热议问题