I'm developing application in OSX 10.9 and Xcode 5.0.2
I'm using making workspace. It separates on two parts. Static library and bundle application.
Bundle application should link static library and includes headers for the static library which I added to the Public header group in the Build Phase of the Target. Also I've prescribed $(PRODUCT_BUILD_DIR)/usr/local/include in the header search path of the bundle app.
But problem - bundle app target doesn't see header files of static library target.
I found answer. Predefined path was set as user header search path but in code I used #import "" instead of #import <>. So right answer - use proper import syntax.
Related
Since Bridging, Headers are not supported in framework targets,
I've tried to import OpenSSL headers in the framework umbrella header. But the headers need to be public and I don't know how to make them public. I've added the OpenSSL framework as a reference folder. So my question is how to make them public?
Another approach I've been trying to add a file called "module.modulemap", which as the name implies creates a swift module that can be imported to be used by the framework. I can build my framework target successfully, but when I try to build my OSX Application which uses my framework, a swift error pops up saying that it cannot find the OpenSSL headers.
I've worked around this issue by adding to the OSX Application build settings headers search path, the path for OpenSSL headers it works. Not sure what is going on here, can someone explain why is this happening and a suggestion for best practice on how to achieve using swift with open SSL in a framework?
This is the contents of the modulemap file:
module OpenSSL [system] {
header "../OpenSSL/include/openssl/pkcs7.h"
header "../OpenSSL/include/openssl/objects.h"
header "../OpenSSL/include/openssl/ssl.h"
header "../pkcs7_union_accessors.h"
link "ssl"
link "crypto"
}
I'm trying to run an IOS app created by another dev that is using a cocoapod from a private repository I have no access to. I managed to extract the .framework bundle from the IPA and add it to the xcode project but it is not being recognized (I get "No such module").
Is it possible to do what I'm trying to achieve?
So far, what I've tried:
build it in release as I guess the framework in the IPA is in release
add the .framework as embedded binary
add the .framework as Linked Framework and Libraries
copy the .framework to ~/System/Library/Framework
update the Frameworks Search Path including $(SRCROOT), recursive, hardcoded paths, etc.
change the .framework location to "Relative to Build Products"
Thanks!
It wasn't that much easy to get the frameworks used in project from ipa file.
Whenver the application runs for first time, also when you archive your application, all the linked .frameworks will get converted to .dylib that is dynamic libraries.
What is static library - a unit of code linked at compile time, which does not change.
What is dynamic library - a unit of code and/or assets linked at runtime that may change.
Framework - A framework is a hierarchical directory that encapsulates a dynamic library, header files, and resources, such as storyboards, image files, and localized strings, into a single package. Apps using frameworks need to embed the framework in the app's bundle.
Dynamic Library
A dynamic lib file is just resides inside the framework folder.
Following is a description from apple documentation
Dynamic libraries outside
of a framework bundle, which typically have the file extension .dylib,
are not supported on iOS, watchOS, or tvOS, except for the system
Swift libraries provided by Xcode.
Ref: Documentation
So you cannot simply copy a .dylib to xcode bundle and just use it. There is some sort of security too.
Another approch
It is possible to decompile the source code from .ipa files. You will get idea from below links.
SO Question regarding decompiling of ipa file
Decompilation Possibility
It seems that when an app is archived for distribution, the Headers and Modules folders are removed from the .framework bundle.
The Header folder contains the .h headers for Objective-C and the Modules folder contains the .swiftmodule equivalent files for Swift.
Without these files you have no public API to consume for the framework binary, so unfortunately this renders the frameworks unusable without reverse engineering.
I am trying to compile a C++ project that uses OpenCV in Xcode 6.2. I have downloaded OpenCV and the header and library files and setting as follow:
Header Search Path: /usr/local/include/opencv2**
Library Search Path:/usr/local/lib
and opencv is truly in this Path,but I get error:
Lexical or Preprocessor Issue
/Users/radio_lee/Desktop/project/OpenCV/OpenCV/main.cpp:1:10: 'cv.h' file not found
when I change the Header Search Path and Library Search Path like that:
Header Search Path:
/usr/local/include/opencv2** and /usr/local/include/opencv
Library Search Path:/usr/local/lib
another error:
Lexical or Preprocessor Issue /usr/local/include/opencv/cv.h:63:10: 'opencv2/core/core_c.h' file not found
/Users/radio_lee/Desktop/project/OpenCV/OpenCV/main.cpp:1:10: In file included from /Users/radio_lee/Desktop/project/OpenCV/OpenCV/main.cpp:1:
OpenCV is a Private Framework,Since it is a Private Framework, it must be copied to the Frameworks/ directory of an Application Bundle, which means, it is useless for plain unix console applications.
We can see the detail in this web site :http://docs.opencv.org/doc/tutorials/introduction/table_of_content_introduction/table_of_content_introduction.html#table-of-content-introduction
This folder contains toolchains and additional files that are needed for cross compilation.
For more information see introduction tutorials for target platform in documentation.
I need to make a static library in xcode of my project , so that i can use it other project by linking it, I have through the tutorial of making static library on icodeblog.com
I have some of the following questions ??
1)- Wat does a library actually contain ? does it contain compiled version of both the .h and .m files of the project or just of the .m files ?
2)-If It contains compiled .h and .m files , then why do we need to add .h files in the project in which we are using the static library(By using the copy headers option)
3)-Even after adding .h files to that project , then why does the following error comes ?
"$OBJC_CLASS_NAME appeared in CLASS.o" not found ...
To make a static library I heartily recommend this approach
To answer your questions:
It contains object code for the contents of your .h and .m files.
The header files lets you use the code in the library. If there are no header files, your project would not know what to call.
If you are using the correct header files, this indicates to me that you are not linking against the correct library or that the library is incorrectly built. Is the guide you have been using correct? The guide I am pointing to works for me and many others.
I got the answer for problem...it is because libraries cannot be tested on Simulator
need to test on devices only ..
thats why . i was getting the error mentioned in "3)"
I want to share my Xcode project as a static library for other people to use in the xcode emulator (giving them as little raw source code as possible). How do you use an AppDelegate from a .a library file in Xcode or UIBuilder?
I copied the main Window.xib file to a new project and included all of the other source files in a static .a library that I thought I would be able to invoke somehow. What do I have to do to launch my main product that is compiled into the .a library from a brand new Xcode project that is including that library?
You'll have to link to the static library. Include it in your new Xcode project, and then in the target for the application, go to the General tab and set the library as linked. You'll probably want to copy it into your new project's bundle (in the Frameworks directory), using a Copy Files build phase. You'll also need to reference the header files for the static library for avoid warnings.
This is a much better solution found in someone else's question:
iOS Question. Can I distribute the Xcode simulator versions of my app?