CloudMade Services Are Now Free – Sign Up Today

If you are a mobile or web developer – we have good news! As of today, when you sign up for a CloudMade developer account all of our services will be free of charge and will let you make money with location based advertising (LBA).

CloudMade’s services include:

Right after you sign up for a CloudMade developer account, you’ll also get LBA with revenue share and instant access to our 10,500-strong developer community to help you get started. To find out more about our mobile services and to sign up, click here. More about our web services can be found here.

Already have an ad partner or want an SLA? Get CloudMade Select

If you already have an ad partner and don’t want CloudMade ads in your app or you need an SLA then CloudMade Select is for you.

By signing up to this plan developers get a whole host of additional benefits including: guaranteed response times for support; guaranteed SLA; HTTP services access; HTTPs/SSL (coming soon); support for intranet apps and no user limits.

New Support Site Now Available

We’ve also just launched a new support site that contains FAQs, Forums and Issue Trackers – everything you need to build awesome apps.

May 16th, 2010 - Posted by Nick Black in for developers

iPhone Static Framework

Problem with iPhone code sharing

As we all know Apple has not left developers opportunity to create frameworks for iPhone. However, there are a lot of situations when code has to be shared between different projects or even distributed to others developers.

Alternatives
There are a few approaches for the code sharing or distributing. Firstly, code can be shared/distributed as a source code. Although this approach is quite straightforward and XCode provides a good mechanism for including XCode project to another project, developers have to do some extra steps such as setup dependencies and path for headers. On the one hand it seems quite simple for the experienced developers, on the other it might be a problem for the new developers .

Second approach is to distribute code as a static library. This approach is well known and is used widely in Linux/Unix development thus a lot of developers are familiar with it. However, there are some disadvantages of using it in iPhone development which relate to dynamic nature of Objective-C. The problem is that static libraries are normally used for C/C++ code which has neither properties nor categories and so when, for example, Objective-C category is wrapped in static library a developer has explicitly to set additional linker options:

-ObjC
-all_load

If developer forgets to set the options mentioned above he will get runtime error “unrecognized selector sent to instance”

Static Framework
The most suitable alternative, in my opinion, is a ’static framework’. The idea behind is to force compiler to believe that it uses normal iPhone framework whereas shared libraries are substituted by static libraries. Thus if you have the code you want to share as a static library it is quite easy to transform it into a framework. Afterwords such framework can be added to a project without any extra efforts from the developer’s side.

How to create a Static framework
Since there is no option to build frameworks for iPhone in XCode I recommend using a static framework. To build it into XCode MacOS framework template should be used. Static framework has the same structure as a normal framework. Only a few extra steps have to be done:
link together static library for iPhone Simulator and iPhone Device
add file from the previous step to framework bundle

To make it easy we will write a shell script which does all the work. We will use a lipo utility which is distributed with XCode installation. This utility allows to link a few libraries into one file. Afterwords this file will be copied to the framework bundle and appropriate links will be created.

FRAMEWORK=”${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.framework”
lipo \”${BUILD_DIR}/${CONFIGURATION}-iphoneos/libDev.a” “${BUILD_DIR}/${CONFIGURATION}-iphonesimulator/lib Sim.a” -create -output “${FRAMEWORK}/Versions/Current/${PRODUCT_NAME}”cd “${FRAMEWORK}” && ln -sf “Versions/Current/${PRODUCT_NAME}” ./

This script should be added into a project as a build phase script through the project menu. As a result we get a static framework containing code which now can be easily shared.

LINKS

Mac OS Frameworks

lipo man page

Static Framework

May 10th, 2010 - Posted by Nick Black in api, for developers, iPhone