1

I am using a third-party library,say: libABC.dylib

I want use the dylib in an open source application,and want to install into my iphone 4,with ios 6,without jailbroken. On doing a

$ otool -L libABC.dylib
libABC.dylib:
    libABC.dylib (compatibility version 1.0.0, current version 1.0.0)
    libXYZ.dylib (compatibility version 0.0.0, current version 0.0.0)
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version
111.1.5)

Now i want to ship the dylib, with my app , install into my iphone 4. For that i have changed the dylib paths as

$ install_name_tool -id    @executable_path/../Frameworks/libABC.dylib   libABC.dylib

also,I added libABC.dylib to Frameworks under the project in Xcode.

This changes the inside dylib paths as

$ otool -L libABC.dylib
libABC.dylib:
    @executable_path/../Frameworks/libABC.dylib (compatibility version
1.0.0, current version 1.0.0)
    libXYZ.dylib (compatibility version 0.0.0, current version 0.0.0)
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version
111.1.5)

The problem is: libABC is loaded at app launch time, i am unable to change this path, to a path relative to my mach-o binary (inside my app bundle) So my app is failing to load.

Dyld Error Message:
  dyld: Library not loaded: /usr/local/lib/libABC.dylib
  Referenced from:
  ....
  Reason: image not found

Please suggest me some direction. The third party library is only creating dylib, no static libs

I also tried setting XCode options to get dylib from "@executable_path" but it didnt work. and I don not load my dylib through code?

Please suggest. I am clueless here. Advance Thanks :)

Bhavin
  • 26,755
  • 11
  • 52
  • 91
explorer
  • 409
  • 2
  • 10
  • 19

2 Answers2

2

Unfortunately NO, you are out of luck, start looking for alternatives. You can't add custom/third party dylibs to an iOS project, iOS project only support addition of built-in dynamic libraries. Moreover any tries and success to add dylibs may cause you app rejected from apple.

Why? Have a look at this post for detailed discussion. specially the 2nd comment on marked answer.

Community
  • 1
  • 1
Adil Soomro
  • 36,617
  • 9
  • 98
  • 146
0

Like you could read in @Adil Soomro's reference, third party frameworks are not supported because of security reasons. That's why you have to delete all the frameworks that appear inside the log when you try to build an app. Normally it should work if these Frameworks are not included. If the debugger will turn on while building you should press play till the app will be installed.

But keep looking what kind of frameworks you are using so you don't get rejected when the app will be reviewed.

Further more, a related error method can occure if you start an app on ios 5.1 or less and some of your frameworks are not supported on these os versions.

Alex Cio
  • 5,752
  • 4
  • 40
  • 73