3

my goal is to build a static iOS library with bundled resources. I have been doing this successfully on OS X years ago, but I am running into an issue here.

I am adding my resource with a linker flag:

OTHER_LDFLAGS = -sectcreate __DATA __FOO resouces/foo.bin

The Xcode 4.6 libtool gives me the error:

libtool: -dynamic not specified the following flags are invalid: -sectcreate __DATA __FOO resouces/foo.bin

I have seen similar questions here, but always in the conjuction with the -ObjC flag. Is the -dynamic flag required for -sectcreate these days? Am I doing it wrong?

Thanks

Alex

ldav1s
  • 15,885
  • 2
  • 53
  • 56
below
  • 929
  • 6
  • 26

1 Answers1

0

You can't include resources with static libs. Since shared libraries are not supported in iOS, you'll have to live with this limitation. Quoting from the docs "Static libraries cannot include resources directly, but a static library project can provide resources which an application can reference and include in its Copy Bundle Resources phase."

Karoly Nyisztor
  • 3,505
  • 1
  • 26
  • 21
  • I know you did not write the docs, but how exactly can't that? I can add a data section with -sectcreate as mentioned above, and I can access that section from my code. That is not exactly the most elegant, or Apple-like way of referencing resources, but it works perfectly (when it works) – below Apr 03 '14 at 11:41