how to add .bundle file to a nativescript plugin - plugins

I have some thirdparty code I want to add to my nativescript (iOS) project. The code consists of a .framework file and a .bundle file which contains a .momd file. I was thinking of adding this via a custom plugin, the docs are pretty clear on how to add the .framework file, but am not sure how I add and reference the bundle and underlying .momd file. Does anyone have any experience of this that they can share please?

I spent a lot of time poring over the iOS interop documentation while working on my nativescript-midi plugin, but I don't recall seeing anything specifically on adding bundles or .momd files. If possible, I suggest you create a new "container" iOS framework project in which you can import your desired framework, bundle, and .momd file, and then import that combined framework project into your plugin via a Podfile. That's essentially the approach I took to import a C library in my project (the cocoa-midi-message-parser repo referenced by the Podfile in my plugin).

In case anyone else needs to do this. I ended up using cocoapods xcodeproj gem to inject my file into my workspace file. A gist of the working code is here.

Related

Suddenly headers in headers not found <module-includes>:1:9: note: in file included from <module-includes>:1: Xcode

I have been working for a while on a project that implements a custom framework that uses a C library. The framework is written in Swift and I created a module to expose the C headers to swift. The framework was started in a different project, the framework project was then copied to the root of my app project and it was added to my app project as embedded binary. By doing that I aimed to develop the framework, which it is a git submodule of my app project, while I was coding the app.
The framework, as I said, uses a C library and I have the .a files for both debug and release and it provides with a headers include folder. So in my framework project I have the following structure:
and for the static libs
The static libraries where imported as framework and the "library search path" modified for using debug or release. The header search header path was also modified by adding the root folder where all the includes are located.
The Module is located in a folder inside the product folder and defined as:
So that has worked until today. Maybe it was wrong but it never complained.
So the headers are found but the headers inside the headers can't be found.
What am I doing wrong?
I have tried to include as many information as I could. I hope it will be enough.
Thank you.
Well, I think what caused the problem. If I am wrong please let me know.
I have figured out that in "Swift Compiler -> Import Paths", which where I declared my OHNet Module path, you also need to declare the root folder for the "imported headers" so:
Clean and Build and the error is gone.

Module created in a framework not found in a project in which framework is embedded

I am trying to create a swift framework containing both facebook and google SDKs for login, so that by implementing my framework, both of them may be used in a project without embedding them separately. I found out I can use pods for facebook SDK, but I have to add google SDK manually into my framework.
To reach classes in google SDK, I tried to add
#import <GoogleSignIn/GoogleSignIn.h>
into framework's umbrella header. However, when embedding my framework into project, it states that the file cannot be found.
I tried using the module approach instead. I created module.modulemap file defining GoogleSignIn module. I had no problem using the module in a framework.
However, when embedding my framework in a project, it states that module cannot be found. I even tried to import Google SDK into project itself and creating module in a project, but the error did not disappeared.
Could you please help me how to import google SDK into framework so that I can use my own framework in a project without any problems? Thank you in advance.
You can do this with an Objective-C bridging header.
First add an objective c file, then you will be prompted to create a bridging header. Click yes and then delete the other objective c file.
In this file place your import statement:
#import <GoogleSignIn/GoogleSignIn.h>
(This is assuming you have imported the SDK manually.)
Make sure you've imported your framework in Linked Frameworks and Libraries, embedded binaries and to Target Dependencies in the app's Build Phases setting. for this to work. In this solution, you can add the swift framework .xcodeproj file as a file of the main swift project.

Is it a good practice to have more than one *.xcodeproj file in an xCode project?

I want to know what's the best practice to use when integrating external SDK to my project, specifically how to handle the *.a file and the *.xcodeproj file.
Examples of external SDK packages: PhoneGap, Facebook, Google-Analytic.
Is there a reason to copy the *.xcodeproj to my existing project or is it enough to just use the *.a file?
Are there pros and cons for having more than one *.xcodeproj file in a single project?
You would never copy the .xcodeproj into your app.
Typically you would add the library (./a) or any headers and implementation files required (.h & .m).
Often you would compile the 3rd party SDK xcode project to a library file and include that compiled library file.

Libxml in a library for ios

I have created a cocoa touch static library that contains functionality that I want to include in several apps. This library is linked to libxml and I have the header search path /usr/include/libxml2. The library builds correctly.
I include this library in another xcode project as a reference (by dragging the library xcodeproj file into my app xcode project. I also setup the target to have the library as a direct dependency, setup the header search path to include /usr/include/libxml2, and add libxml2.dylib in the frameworks.
The problem is, when I try to build the project is has a build error:
Libxml/tree.h: No such file or directory.
I initially had this problem trying to build the library and solved it by adding the header search path and framework into the project for libxml2.
Incidentally, i have another app that uses the library but does not use libxml, it builds and runs correctly.
So the problem seems to be using libxml in both the app and a linked library.
Anybody any ideas?
Yours hopefully,
Neil.
You probably need to add the include path /usr/include/libxml2 to both the target and the project.
To add it to the target, right click on the target and select Get Info.
To add it to the project, go to the Project menu > Edit Project Settings.
In both cases, make sure you've selected Configuration: "All Configurations".

TTNavigationController not working

I have downloaded the latest build of the three20 library but it doesn't include the TTNavigationController. I looked through the files on github and found the classes there though. So I downloaded them but now I can't find it's parent class TTBaseNavigationController anywhere. Does anybody know what's going on with the three20 build I got?
You need to import following
#import <Three20/Three20.h>
The Three20.h file includes Three20UI.h, which contains the TTNavigationController.
If you are using xcode 4, see the following instruction on importing the Three20 project into your project and setting up appropriate dependency, HEADER SEARCH PATHS and static lib linking.
http://three20.info/article/2011-03-10-Xcode4-Support