How do I properly implement Urban Airship in Xcode 4.2 for iOS 5? - iphone

I am new to iOS Development and am now venturing into adding different features into my Apps and now would like to be able to implement Push Notifications into iOS5 apps with Xcode 4.2.
I have tried my hardest to understand the iPhone Developer instructions regarding Push Notifications, but found that the easiest method (according to many sources around the internet) would be to use Urban Airship!
I have gone over this for quite a number of days now and tried and tried my hardest to be able to complete the steps required in the Set Up A New Application part of the document.
It states:
The core library requires your application to link against the following Frameworks (sample UIs have additional linking requirements):
libUAirship-.a
CFNetwork.framework
CoreGraphics.framework
etc, etc, etc
http://www.youtube.com/watch?v=EwqM4wfaYNU
The link just above is a YouTube video of what steps I took to follow these instructions and it's really starting to get to me. I would like someone to be able to provide me with some assistance and explain what I am doing wrong, and how to better understand the way you link against the following Frameworks because I have tried my hardest, and never managed to understand it.
Any help would be GREATLY appreciated from anyone.

You are trying to #import a static library in your code. The .a file is a library, not an include file. You just need to add them to your project and then include the .h file in your project.
Search Google for adding static library to xcode, or similar. For example, A quick Google search found this

Related

Compile XCode Projects online

I'm using the mosync library for develop iPhone applications. It generates the Xcode project ,
now I need to compile it to make it run on a iphone. So for that I need a mac.
do anybody know somewhere online to find online compiler which do that with a web based interface?
--thanks in advance--
Its really a difficult ask, since apples terms of use on certificates stop people from doing this.
But I got a paid solution for the same problem you mentioned which provides Xcode on Macintosh with latest updates. It just cost about 10$-20$ per month. Initially, you will get the trial offer too. If you like it, then you can subscribe it.
But friends beware of those who provides hacintosh version.
You can refer to following link-
http://www.xcodeclub.com/
http://virtualmacosx.com/
If you want to compile C or C++ right on iPhone/iPad you can try CppCode ios app

External Static(.a) Libraries in iPhone projects

Over the last few months I've come across various chatter of external/private libraries not being allowed in iPhone apps.[Just to be clear, this is not something thats going to come, its something I was wrongly under the impression that already exists.]
I was looking at the WunderRadio source: http://www.wunderradio.com/code.html
and I noticed they have 3+ .a files in there project.
libcCommon.a liblibmms.a and libffmpegLib.a are the ones I'm looking at.
Have I been misinformed about the use of this kinda of libraries in iPhone projects? Will Apple accept and approve projects that are using them? If so what is it thats not allowed? Is it just use of Apples own private and undocumented libraries, but you are allowed to include your own?
Many Thanks,
-Code
Static libraries have always been allowed for iOS development and there is no sign that position is going to change at any point (why would it?). Dynamic libraries are not allowed and will result in the rejection of your app.
I think they'd be crazy to do that.
There are so many 3rd party libraries out there that it would pretty much kill the developer crowd they've got now. Imagine if you had to write every library over, from scratch? That's nuts...
Of course, I have no proof one way or another. I just think they'd be insane to try and do that.
.a files are called static libraries. When you build your code, they essentially get compiled in at build time. These are definitely allowed by Apple. In fact, XCode provides a template for a "Cocoa Touch Static Library" when creating a new project.
.dylib files on the other hand are dynamic libraries and are not allowed by Apple. They are separate code files that can be shared by multiple applications as their code gets brought in to your app at run time.
Saurik (the guy who created Cydia) solved this issue by creating Mobile Substrate for jailbroken iPhones. It allows devs to create dynamic libraries in order to alter the functionality of existing Apple classes.
Hope this clears the issue up.

C Binary/Source Code in an iPhone XCode Project

What's the best practice to include existing C Libraries into an iPhone Project? I searched the Internet and actually found some pieces but nothing that explains the exact way to do it.
I'm trying to include the following Citrix XenServer SDK Library.
Any help is appreciated. Thanks!
You could try to build a static library and link against that.
I didn't try that myself yet, but as far as I could see, libxenserver has libxml2 as its only dependency.
libxml2 is available on the iPhone so you might have a chance.
To get started, create a Cocoa touch static library project and drag the C files into the project.
Now you have to figure out where to place the include files.
This might get a bit tricky and you will start with a lot of compile errors, but to me it seems possible to get it compiled.
The way I did it was to just create an iPhone static library project in Xcode and drop all the library's files in there. Then check if it builds and if the build settings are appropriate for the library you wish to compile. To add the newly-created library to your binary, you should follow the steps explained in the bottom part of the Three20 readme.
Note that you can only add static libraries to iPhone projects if you wish to get them into the App Store. Xcode also doesn't provide means to create dynamic iPhone libraries.

Can I develop my own objective-C Framework for Cocoa Touch Applications?

Is it possible to create an own obj-C Cocoa Touch framework which can be used by other developers? And furthermore can you protect this framework?
I've created templates for Xcode 4 that allow you to build universal iOS frameworks (which work in both device and simulator).
Once the templates are installed, you simply select "Static iOS Framework" when creating a new project and it does the rest. It also works with unit tests.
https://github.com/kstenerud/iOS-Universal-Framework
You can create a static library. There is an option in the XCode project chooser to do this. You'll have to distribute the compiled static library file and the header files to users of your library. Your actual implementation files (.m) do not need to be distributed.
GHUnit does a good job of this - packaging up the libraries for both simulator and device - so I recommend looking at this project. (I also recommend using this library for unit testing :-)
The frameworks in Objective C are typically just C / ObjC code and a bunch of classes, nothing amazingly special. As such, you can create your own if you'd like, and then just include that in your project when you build it. The iPhone doesn't care about the difference, it just knows to put all that code into your app, along with everything else.
Have a look at the Framework Programming Guide on Apple's website. It will get you started. Essentially what you'll do is create a Framework project in XCode and then go from there.
As for "protecting" your framework, I assume you mean making your code unreadable. I'm not sure if and how you can do this, but perhaps Apple's guide will say something about it.
Yes you can create frameworks for use with Cocoa Touch.
However there are these caveats:
has to be a statically linked libary, no dynamic loading (dyld) for us
should be a combined (lipo) library for i386 (simulator), arm6 and arm7
you need to hack a bundle project into a framework
you should embed (small and few) images into the library so that the developer does not have to mess around with resources but just drags/drops it into his project
... or if you have large and many images build a bundle with these
I have guides for these things on my site.
1+2 = http://www.drobnik.com/touch/2010/04/universal-static-libraries/
The other links you have to google because this site does not let me post more than one URL.
You could make a static library available as binary (i.e. rudimentary "protection") to third parties, but not a dynamic one, as Apple's App Store policy prevents dynamic linking.
Take a look at a worked example for static libraries given at
this site
If you're going to do it, in my opinion JSON.framework is a great example to follow. To hide/obfuscate the source code is a different story, and a different question entirely,
When creating a new project, navigate to iOS > Framework & Library > Cocoa Touch Framework, it's as simple as that. When you are successfully compile, .framework will be created under Products folder in XCode. Right click to show in Finder, and you can find the output.
It's unlikely this will work the way you want it to because the other developers won't be able to use your framework. This StackOverflow Question explains why.

Stomp.framework iPhone linking. Anyone have experience?

Having trouble linking the Stomp.framework into an iPhone SDK application.
http://code.google.com/p/stompframework/
I follow the instructions, adding it to the project, adding a Build Phase for Copying the Files, and including it via #import .
I keep getting "image not found".
Anyone try this and/or have a clear idea why?
This may be better:
http://github.com/juretta/objc-stomp
I found it fairly easy to get going.
The iPhone SDK doesn't support embedding frameworks in applications. I believe it supports dylibs, though I'm not certain of that fact. However, the safest thing to do would be to take the source of that framework and compile it directly into your application.
Make sure that whatever folder contains the .framework bundle is listed in the Framework Search Paths setting of your target or project.
There's more you'd need to do if you want to embed the framework in your application but that's another question.
edit: Totally ignored the iPhone requirement there, you'll have to compile the framework as a static library and link against that.