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

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.

Related

how to add .bundle file to a nativescript plugin

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.

Does a static library add inside another static library? iOS/Xcode

I'm creatic a static library to distribute to other projects (they don't see the library source code), and I wonder some questions:
-I follow this guide:
http://developer.apple.com/library/ios/#technotes/iOSStaticLibraries/Articles/creating.html
I create a .a file, several .h files and another .bundle file. The question is that my project library uses includes ResstKit (and uses it). In the product directory I see my library .a and the RestKit .a file. Do I have to distribute that restkit .a file? or is it already included inside my own .a file?
-The Apple guide doesn't say anything about fat or universal libraries. How can I create my library for the device and simulator at the same time? I see some scripts on the net, but I guess there must be some option there. What do you think? (BTW, do fat and universal have the same meaning?)
-Is there anyway to tell the target zip everything or create a DMG package? I guess using a Python script is possible, but I mean using any Xcode option.
Thanks in advance.

Adding SoundTouch to Xcode/iPhone

I've downloaded the SoundTouch folder from their website and now I don't know what to do with it. I'm trying to integrate the pitch-manipulation feature into an iOS app that allows the user to select a song from their library and change the pitch.
What do I need to include in the Xcode project from the SoundTouch folder, and where do I go from there? Any help is appreciated.
If you still need it to use SoundTouch in your iOS project, I have share a GitHub repository with that libraries compiled for armv7, armv7s, arm64, i386 and x86_64
https://github.com/enrimr/soundtouch-ios-library
To implement that compiled library in your project, you have to add SoundTouch directory (which includes libSoundTouch.a and the directory with headers) in your Xcode project and then include
#include "SoundTouch.h"
in your controller file.
I found this question googling "building soundtouch in Xcode"
It seems there is a project on github that has completed this successfully, https://github.com/mwhagedorn/SoundTouch
I was able to clone the repository, build the project, and include the libSoundTouch.a file in my project.
So you will need to include the soundtouch.h in the objective c file you want to access it from. From there create an instance of soundtouch, i.e. SoundTouch audioEngine = SoundTouch.createInstance();, and go from there.

Reconfiguring a dynamic library

I'm working with an open source library that's made available as a git repository (XML-RPC) and I'd like to use it in an iPad application. As I understand it, iOS applications should use static libraries for their linking.
Since this comes as a dynamic library, how can I convert it to something I can link with my app and use?
Maybe naive answer but why not just add all the relevent files in the repository to your app and just build it?
Put the files in a seperate folder obviously so you can update them to a newer version if you need to etc. Lots of projects I've done have an 'external' folder that just contains codethat I use from 3rd party sources. I've usually got the source so just compile it into my app and don't bother with making it a library.
Or are there tricky conditions that need to be met to compile this code?
I ended up doing this in several steps:
First, I opened the library project in Xcode and created a new target for the static library. I then made a directory in the project folder called "XMLRPC" and moved all the header files to it. I deleted the now-red invalid references to the header files, and re-added them (but kept the box for copying them to the current folder unchecked).
I added this Xcode project to my main project with a relative reference. I opened my main app's target and added the library project as a direct dependency, and checked the "Always search user paths" option on my main app's target settings.
Lastly, I modified the general Xcode preferences to use a shared build directory. I haven't tried it without that since it was something I wanted anyways; it might not be necessary.
My revision control has two folders in it: one's my project, and the other's the library. The library is still under git control within mercurial; I'm hoping this doesn't cause any issues.

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