David Nelson
David Nelson

Reputation: 752

iOS Custom Framework .framework file

I've followed this tutorial:

https://github.com/jverkoey/iOS-Framework

and have everything working on the development end. Even the dependent product works fine. In the end I have a .framework, .a, headers folder, and include folder after building. The article says you just have to drag the .framework over to your project and include #include However, when I do this and build I get a linker error:

ld: framework not found MyFramework

Please remember, I have this working, linking, etc in my dependent project but in that project I copied the Framework project into the Testing project. Are there missing steps I have to do after dragging the .framwork over? I've tried dragging the .a as well with no success (same error message).

Thanks for any and all help.

Upvotes: 2

Views: 2541

Answers (3)

Are you sure you have the framework structure completely correct? Since you were just using it as a subproject before you may well not be building the framework directory correctly.

It should look like:

MyFramework.framework     //(directory)
  info.plist
  MyFramework             //(symbolic link to Versions/Current/MyFramework)
  Resources               //(symbolic link to Versions/Current/Resources)
  Headers                 //(symbolic link to Versions/Current/Headers)
  Versions                //(directory)
    Current               //(symbolic link to directory "A" below)
    A                     //(directory)
      Headers             //(directory containing framework headers)
      Resources           //(directory holding framework resources)
      MyFramework         //(actual compiled library, really a .a file)

The .a file in your framework should not end in .a. And as noted all of those symbolic links have to be right, an "ls -l" in your framework directory should look like:

drwxr-xr-x   7 kendall  admin   238B Feb 19 13:36 ./
drwxr-xr-x  11 kendall  admin   374B Feb 19 13:36 ../
lrwxr-xr-x   1 kendall  admin    24B Feb 19 13:36 Headers@ -> Versions/Current/Headers
lrwxr-xr-x   1 kendall  admin    30B Feb 19 13:36 MyFramework@ -> Versions/Current/MyFramework
lrwxr-xr-x   1 kendall  admin    26B Feb 19 13:36 Resources@ -> Versions/Current/Resources
drwxr-xr-x   4 kendall  admin   136B Feb 19 13:36 Versions/
-rw-r--r--   1 kendall  admin   215B Feb 19 13:36 info.plist

The contents of info.plist (which tells the linker what the name of the static library in the framework really is) look like:

CFBundleDevelopmentRegion
English
CFBundleExecutable
MyFramework
CFBundleIdentifier
com.pushio.pushiomanager
CFBundleInfoDictionaryVersion
6.0
CFBundlePackageType
FMWK
CFBundleSignature
????
CFBundleVersion
1.0.0

Upvotes: 3

David Nelson
David Nelson

Reputation: 752

In the above tutorial you need to make sure you remove the Copy Files Build phase that the latest version of XCode adds. This was caused because of this step. Everything else was correctly added.

Upvotes: 0

shyamsundar1988
shyamsundar1988

Reputation: 529

*) I suppose you missed clicking the checkbox "Copy items into destination groups folder(if needed)" when you dragged or copied the framework over.

*) And also make sure you link the framework by going to project -> targets -> Build phases ->Link binary with Libraries and adding the framework.

Upvotes: 2

Related Questions