Include library in Mac Project - macos

I have a Library project "Mobiledeviceaccess", if i build this project, i get libMobileDeviceAccess.a file in build/debug, How to use this library in MAC application Project. How to use this library class file?

Just add the .a file to the project in the same way that you would add a source file. You'll also need to add any relevant .h files for the library's public API.

Related

Adding swift framework extracted from IPA

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.

.aar Binding Library missing references in original project

I'm trying to follow this guide to build a binding library based off an AAR. I've added the .aar under the Jars folder in a new Java Bindings Library project. I set the build action to LibraryProjectZip. When I try to build I get errors telling me The type or namespace name 'BasicWebViewClient' does not exist', however, this file is in the original project. When I browse the .aar, it's not there. Anyone know why the class wouldn't be included?
Thanks

Add dynamic library to firebreath

I'm developing a plugin for mac. I'm trying to use afnetworking and other frameworks which needs arc. I'm trying to create a .a(library) for the framework and access it in firebreath. I tried adding the directory which contains .a using include_directories in projectdef.cmake then linking it in target_link_libraries. Please lemme know how to add this and whether the framework can be used in firebreath without any pitfalls
I have used external libraries in firebreath. Though I have used editors to link the libraries. You need to specify .h files for the function prototypes, along with .a files which will dynamically link to .dylib
Try adding these via Xcode and see if that works.

static library in xcode 4.4.1

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)"

Share an Xcode project as a static library for other people to use in emulator. How do you use an AppDelegate from a .a static library file in Xcode?

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?

Resources