How to link a dynamic library Xcode 5 - objective-c

Can you point me to a tutorial which shows how to link to a dynamic library.
I created a dynamic library. Now I've got no clue how to include it into your project.
What I tried is
1.I copied the dylib and header folder into my project.
2. I gave library search path as $(PROJECT_DIR)
3. I gave header search path as $(PROJECT_DIR)/include.
Now it builds and links just fine. But when I run it, it gives me this error
.yld: Library not loaded: /usr/local/lib/test_dynamic_lib.dylib
Now i read in documentation that you have to install the library in that path. How to do that?
or you can manipulate runpaths. I didnt get a clue what it says. I'm actually a beginner in cocoa development.
Can you explain how to do that? Or point to a tutorial. I couldn't find any.

I found the answer.
I wrote a build script on my target.
export DYLIB=myLibrary.dylib
mkdir "$TARGET_BUILD_DIR/$TARGET_NAME.bundle/Contents/Frameworks"
cp -f "$SRCROOT/$DYLIB "$TARGET_BUILD_DIR/$TARGET_NAME.bundle/Contents/Frameworks"
install_name_tool -change #executable_path/$DYLIB #loader_path/../Frameworks/$DYLIB"$TARGET_BUILD_DIR/$TARGET_NAME.bundle/Contents/MacOS/$PRODUCT_NAM
And yes thnx The Paramagnetic Croissant for poiting me in the right direction.

Related

How to make erlang application?

i'm trying to build the example to run an erlang websocket server.
I created all that files and put them into one folder, add the rebar file and ran
./rebar get-deps
inside the folder direction.
But there is no
make
make runconsole
and nothing's happening.
Is there also a possibility to create that websocket server using IntelliJ? I tried to put that 3 .erl files into IntelliJ and want to Build the project but I receive
erlc: 2: Warning: behaviour cowboy_http_handler undefined
The make command reads something called a Makefile, which is a file written in a certain format, which tells the make command what it is supposed to do, e.g. compile some files with the listed names using the listed commands. Because there is no Makefile listed in that tutorial, you should have gotten an error something like this:
No targets specified and no makefile found.
You can contact the author of the tutorial at his github account and ask him where the Makefile is. Actually, the Makefile for the tutorial is here:
https://github.com/marcelog/erws
I created all that files and put them into one folder
The instructions in the Makefile depend on the exact directory structure that the author has here:
https://github.com/marcelog/erws
I tried using rebar3 and changing some stuff in the Makefile, but I still got errors. The problem is that rel directory: I don't know how to create all the stuff in there. You need to use rebar and reltool for that:
https://gist.github.com/FabioBatSilva/f1d1c4ea250302fed8c2
Here is a cowboy websockets example that I came up with last year, see if it helps:
How to Connect Cowboy (Erlang) websocket to webflow.io generated webpage
It uses the Erlang.mk build system as described in the cowboy docs here:
https://ninenines.eu/docs/en/cowboy/2.5/guide/getting_started/

iOS UI Test Project 'MailCore/MailCore.h' file not found

I did a
git clone https://github.com/MailCore/mailcore2.git
I open the
iOS UI Test.xcodeproj
I run the Build
I get the error
'MailCore/MailCore.h' file not found
I cannot understand why that is happening.
What should I do to get this to build?
Some other sources I have found and followed their instructions are below. None of which fixed this problem.
https://github.com/MailCore/mailcore2/issues/316
https://github.com/MailCore/MailCore/issues/19
https://github.com/MailCore/mailcore2/issues/276
I also was able to open the
mailcore2.xcodeproj
and successfully build each of the targets. Which is interesting that I can do that but cannot build the test project independently.
I also followed the video and read me instructions to add to an existing project and was able to build until I added the
#import <MailCore/MailCore.h>
to one of my files.
UPDATE:
The above process I initiated on my iMac.
On my MacBook Pro after I cloned mailcore2 I opened
mailcore2.xcodeproj
first then did the build on each of the targets.
Then I closed that project.
Opened the iOS UI Test.xcodeproj and did a build on that.
This was successful.
However, I still want to know what would cause the problem with the "file not found"
UPDATE 2:
I removed to trash all mailcore2 code from my iMac.
I created different locations in Finder for doing another clone of mailcore2.
I did the git clone.
I opened mailcore2.xcodeproj
I followed the exact same process of building each target like I did on my MacBook
I then opened the iOS UI Test.xcodeproj and did a build.
I get the same problem of
'MailCore/MailCore.h' file not found
Makes no sense to me how it works on macbook but not on iMac.
You can add in target dependency static mailcore ios(mailcore2).
and add the framework libmailcore-ios.a
Its working.
What I finally did was drop mailcore2 into an existing app I already had started.
To do this I did the following:
I removed all traces of mailcore2
I again followed the instructions in the README and the video help.
This time I followed some instructions from
https://github.com/MailCore/mailcore2/issues/276
The instructions in that link says to add the following to Library Search Path:
$(PROJECT_DIR)/mailcore2/Externals/ctemplate-ios/lib
$(PROJECT_DIR)/mailcore2/build-mac/build/Debug-iphonesimulator
And the Header Search Path to
$(PROJECT_DIR)/mailcore2/build-mac/build/Debug-iphonesimulator/include - recursively
But, that did not work for me. I had to add the HARD CODED PATH to each of those 3 folders.
After doing a clean and build I was then able to add the
#import <MailCore/MailCore.h>
Now it BUILDs completely without error for me.
I will go back and try to add proper relative paths to each of those Search Paths.
Hopefully this helps somebody else with same issue.
FWIW
Had same problem, spend hours trying - nothing worked, not ever hardcoding paths.
Then I stumbled on one issue:
if in XCode\Preferences\Locations I go to Derived Data - Advanced and set it to different locations it always reverts it to Unique, when I go back and check it.
Then I went in File\Project Setting to Derived Data - Advanced and there it was set to Unique. I changed it there to Default and now it does not have that issue anymore!
I delete Derived data, clean project and Start build (Ctrl+B) and I can see now how Build is being created in derived data w/o problems. And that what mailcore needs to function.
And, I checked - no need for hardcoded paths either!
Hope it helps somebody.
PS Another feature maybe useful too - XCode\Preferences\Continue building after error though it did not matter in my case

Stuck in building Mailcore library

I am trying to build Mailcore library which I downloaded from below:
git clone https://github.com/MailCore/mailcore2.git
I followed each & every instructions given on below:
https://github.com/MailCore/mailcore2#installation
Even I also checked the below video to make sure all the things are correct:
http://www.youtube.com/watch?v=9fAo6oBzlQI
But I am stuck in building the library and using it. I am getting below error when I am going to compile/build the library
'libetpan/libetpan.h' file not found
'unicode/udat.h' file not found
'ctemplate/template.h' file not found
'tidy.h' file not found

to generate header docs from generated code

I am a beginner in iOS development.We are trying to develop an application in xcode using objective c.We have imported the codes and libraries and builded it successfully.Now the issue is to generate header doc from generated code.For that we navigated to the generated code folder using terminal and gave the following commands:
headerdoc2html –o GeneratedDocDir GeneratedCodeDir
gatherheaderdoc GeneratedDocDir
But it generated 3 zerobytes file only.
Can anyone please help us to solve this problem?
Without knowing your code/configuration, it is guessing only, but you should check
existence of HeaderDoc comments / tags
your configuration in /$HOME/Library/Preferences/com.apple.headerDoc2HTML.config

Create class diagram from already existent iphone code

does anybody know, how i could create automatically a UML class diagram from an already existent iphone project. Is it possible?
Thanks in advance.
Yes, you can use Doxygen:
Install Doxygen (with MacPorts: sudo port install doxygen).
Get a script like this and change the first lines to match your configuration.
Download these files and edit the Doxygen file so it says HAVE_DOT=YES and UML_LOOK=YES.
It will then generate and install a docset that you can read from the documentation browser, or just right click and show contents from Finder.
Or, if you want a graph of dependencies check: https://github.com/nst/objc_dep It uses graphviz.
See also OmniGraffle of all things. If you open an Xcode project with it, it will generate a full class diagram. It can be fairly overwhelming for a large project.