Archive for 'iPhone'

Libraries: Mapping

So today, let’s pull together a roundup of all the mapping options for your iPhone development, shall we?

1) First off, you’re no doubt aware from posts like this that much of the functionality is exposed to any developer through MapKit.framework in OS 3.0 — and for earlier versions you can do more or less the same working with iphone-google-maps-component as we mentioned ages ago. However, if you’re actually planning on making any money off it, the terms of service may very well be an issue, as discussed here. We’ll have to see how that works out.

2) As an alternative to Google, there’s VirtualEarthKit for Microsoft Virtual Earth, also discussed previously here. Unless there’s some specific reason to prefer this, it would seem the path of least resistance has definitely tilted toward 1) with the imminent MapKit.framework now, though.

3) There’s the commercial/free ad-supported option of mapNinja which we mentioned when released a couple months ago, which looks interesting but again probably superseded by official SDK developments.

4) The apparently most popular current option is the BSD-licensed route-me library which, yet again, we mentioned earlier, and can use a variety of sources.

5) And finally, one we actually have not posted about before! Yes, you were starting to wonder why a post with nothing but rehashes, weren’t you? Well, this one looks particularly interesting; the great folks at CloudMade, who wrap assorted useful functionality around OpenStreetMap, now have an iPhone Maps Library!

The iPhone Maps Library lets you build interactive mapping applications for the iPhone. With this API you can

  • Build applications that give users a rich mapping experience on the iPhone
  • Benefit from our tile servers which deliver mobile optimized maps to your users
  • Easily integrate with the iPhone’s location API to show your user’s position in real time

Just like our other APIs, we don’t want to restrict the uses of this API – you are free to create applications that use our maps in any way you like, as long as they comply with the terms of the iPhone SDK agreement. What’s more, this library is open source – so you are free to extend and re-use it as you want.

Well, that’s excellent, isn’t it? The reasonably friendly LGPL for the source license, can’t beat the CC-by-SA data license anywhere, and their API appears to have good documentation, examples, and most important of all, other people have already selected it to do cool stuff with; the apparently well-regarded Trails and OffMaps are reportedly both using the CloudMade library.

So there you go; as long as you’re targeting 2.x users, we’d say that CloudMade deserves to be at the top of your short list for implementation options, and depending on licensing terms, probably even if 3.0 dependence is OK.

‘Course, what we really want to do is get our own topo maps onto the device — come now, if you’re on a ROAD, how much do you really need a map for, after all? — so whenever we get around to seriously comparing libraries, pretty much our only criterion is “so how do we swap our own local tile provider in here then?” which the existence of OffMaps seems to indicate makes the CloudMade stuff the leading candidate for that too!

Continue Reading →

Tip: Code Signing

So, as you may have noticed if you’ve built iPhone apps for anyone other than yourself, it’s a bit of a challenge to coordinate program memberships, distribution certificates, yadayadayada. Wouldn’t it be convenient to just build the app using your own certificate and then have them sign the build for their devices, distribution, etc. on their own, without them having to trust you with their certificates and/or account access, or you adding their devices into your account?

Well, turns out that actually is possible — if you have a signing certificate of your own installed, you can take an arbitrarily signed binary you’ve been sent by whomever and overwrite its signature with your own. Handy, that, don’t you think? Here’s full details, and the man page, but the essence is simple: start up Terminal, and

export CODESIGN_ALLOCATE=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/codesign_allocate

to recognize iPhone ARM binaries, then simply cd into and

codesign -f -s "iPhone Developer" -vv TargetApp

It’ll say

TargetApp: signed Mach-O thin (armv6) [TargetApp]

and that’s it, you now have a re-signed binary suitable for iTunes synchronization. Besides making builds with your certificate for other people to test without needless trust and/or inconvenience, this is also a handy way to test the final distribution build of your application before submitting to Apple, besides testing application binaries signed with any other certificate that you don’t have access to. Convenient, indeed!

h/t: xcode-users!

Continue Reading →

Tip: Tinted Buttons

Here’s a handy tip for creating custom colored buttons on the fly for your iPhone interface: don’t make them buttons at all, make them single segmented UISegmentedControls, and muck with the “tintColor” property. Ooh, shiny!


And hey, there’s something you can apply that nifty color picker we mentioned to have your users customize your color scheme on the fly. Oh, the sartorial possibilities just stagger the imagination, don’t they?
[EDIT: Since UISegmentedControls don’t work quite like buttons, following this tip will make your UI just that little bit off. But here is a much better way to make your buttons shiny!]

Continue Reading →

Code: Color Picker

Here’s a nifty piece of code: a touch-based color picker for your iPhone application!


Not that we can think of a good reason to use it just at the moment … but it’s a nifty piece of code to check out anyways!

Continue Reading →

Unit Testing

So up ’til now there have been some options for doing unit testing on your iPhone applications, but they’ve involved enough effort and annoyance that, well, they just aren’t used as often as respectable programming practice would imply. Not around here, anyways; more like idly kick the idea around, grumble “Why hasn’t Apple seen fit to integrate OCUnit as nicely as in desktop Cocoa projects?” and continue on with non-test driven development.

Well, turns out that it’s actually been there since SDK 2.2, in the simulator at least, and rumour has it that device support may be coming soon! So, it behooves us to get started now, as even running unit tests in the simulator is a useful exercise, yes?

iPhone Unit Testing at the OCUnit authors’ website is a quick introduction with sample project.

iPhone Unit Testing with OCUnit at 6Tringle is a great detailed tutorial.

And at the mothership, read the introduction, walkthrough, Unit Testing Guide, and otest and RunTargetUnitTests documentation to get a handle on just why it’s so nice to be able to take advantage of Xcode’s support!

And on a not completely unrelated note, here’s a project on Google Code called Bromine that aims to let you create automated interface tests:

It maps your entire application to XML structures so you can access your views via xpath and verify values, scroll tables, simulate touches, edit text and more.

This project was inspired by Matt Gallagher’s article (Cocoa with Love: Automated user interface testing on the iPhone) which brings, among others, the base technique for this project: simulate touch.

That looks worth working into as well for a complete testing strategy, indeed.

Continue Reading →

Snippet: 306 Colors

So there was this thread on iPhoneSDK where a fellow was wondering what UIColor to use to imitate’s non-editable text — R81, G102, B145 was the suggestion — and along with that came a post of 305 other colors, from alizarin through zinnwaldite. Which is already more new words than we learn in an average day. So we figured we just had to grab that!

We’d repost it but it’s a bit long and annoying to reformat from text, as we know having just done exactly that … so if you want to find out what UIColors “caputMortuum”, “razzmatazz”, “tyrianPurple” and another 300+ are, download and check for yourself!


And there’s another UIColor helper set in Erica Sadun’s github collection!

UIColor Helper Library Providing 100 Predefined Colors And Easy Color Scheme Creation

Library Providing A UIColor Category For Easy Access To iOS 7 Colors

Handy Library Providing Easy Access To Colors And Gradients Used In iOS 7 Apps And Icons

Handy UIColor Categories Providing Easy Access To Crayola And Pantone Colors

Open Source UIColor Add-On Library Providing Easy Access To Colors Used By Specific Brands

Open Source iOS Library Providing Helpers For Flat UI Colors

bfeher/BFPaperColors: “Flat colors taken from Google’s Paper Material Design.”

Continue Reading →

Code: llamasettings

So, been thinking about implementing your app’s settings internally, perhaps with the code we mentioned before? Well, here’s another fine-looking option, llamasettings at Google Code:

llamasettings is a series of classes to be used in your iPhone SDK application that provide a standard-looking settings list.

There are some screenshots that you can look at of it in action.

Advantages over

  • Pre-canned, working code – You don’t need to fidget with creating tables, figuring out default settings, etc.
  • Standard PLIST file format – based heavily on Apple’s settings schema, so it’s already something you know.
  • Integrated within your application – the user doesn’t need to exit the app to change a setting
  • More extendable – all of the source is available, with an easy interface to add more widget types
  • More configurability out of the box – provides things like date pickers, color pickers, and so on, not available in Apple’s

h/t: iPhoneSDK!

Continue Reading →

Tip: Multiple keychains

As you’re quite undoubtedly aware if you work for more than one client, the process of switching signing identities to select the correct provisioning profile is … non-optimal, shall we say? Our current “solution” actually involves manually deleting all except the currently in use certificate from the login keychain so Xcode doesn’t descend into hopelessly gibbering confusion by actually having more than one distribution option available. And Ad Hoc … well, we just don’t even try that on our development machine anymore.

But ho! Here’s some instructions from an obviously very clever fellow who’s sorted out how to set up individual client keychains with the appropriate certs and keys for each portal you’re involved with. The main trick it seems for getting from what ought to work to what actually works without having to completely wipe your phone and restart while flailing at it is knowing that the only tool that apparently is any good is managing this stuff is iPhone Configuration Utility from Apple, so you should use it for all your profile work, and just make iTunes and Xcode shut up and stay out of the way while the grownups sort things out!

[EDIT: But watch out for some versioning issues with the device communication frameworks; if you've installed a 3.0 beta SDK and then install iPCU, you'll have to reinstall the beta SDK -- not the 2.2.1 release! -- before iTunes/Xcode will see your devices again. Whoops!]

[EDIT: And here is a useful wiki for your clients which includes instructions for the team agent to create and mail you the distribution profile and certificate. A useful place to point them at, indeed!]

[EDIT: And here’s a tip for a script to add to set the keychain to what you want for a project:

/usr/bin/osascript - <<***
tell application "Keychain Scripting"
set current keychain to keychain named "mike.keychain"
end tell

Yes, never forget that AppleScript is usable from the command line!]

Continue Reading →

Code: zip

Feel like using .zip compressed files in your iPhone program? Here’s a couple wrappers for Minizip to make that process easy!

For super simple needs, there’s nuzip on github:

NuZip currently has a trivially simple interface, methods called “zip:” and “unzip:” that take a single argument, a string that would correspond to the command-line arguments given to the minizip and miniunz tools…

And if you need a little more, there’s ZipArchive found on Google Code:

… it’s easy to use, you can declare a instance and call initialize functions, and then call addFileToZip or UnzipFileTo to finish compression or uncompression…

Also note some good advice in this thread about dealing with NSData objects and .gz files.


Open Source Libraries And Examples For Zip, Rar, and 7-Zip Compression

Open Source Easy To Use iOS Zip Compress Library

mattt / Godzippa: “GZip Compression / Decompression Category for NSData”.

Objective-C Library Providing A Clean Syntax For Unarchiving Zip, Rar, And 7zip Files

Open Source iOS Library Providing Direct Access To Data Stored Within Zip Files

Continue Reading →

Resources: cocos2d

So there seems to have developed a general consensus in the iPhone development community that if you’re planning to develop a sprite-based game, the cocos2d-iphone framework that we mentioned waaaaaay back when and a bit later on is the way to go. So since we’re planning on doing exactly that, here’s a roundup of resources for your cocos2d development!

Project and wiki on Google Code, for starters. is the official center for all things cocos2d.

Sapus Media is the creator’s home page with links to cocos2d related stuff as well. Note blog.

cocos2d for iPhone API reference is there as well. Also note wiki. And how to install in Xcode.

Sapus Tongue source and optional support is available at varying prices, and we strongly recommend you support the author by purchasing it — hey, we did!

cocos2d-iphone-discuss is the nice and active discussion list. Note the community pages there as well.

[UPDATE: Due to massive Google suckage, the community is now a bbPress forum!] is the original Linux/Mac/Windows library using Python instead of Objective-C, where more useful documentation can be found.

cocos Live is a Google App Engine-hosted service for high score submissions.

cocoslive-discuss is the companion list for cocos Live.

[UPDATE: Now it’s part of the above bbPress forum too!]

And more good stuff found around the web includes

Whitepaper: Introduction to Cocos2d iPhone from the experiences of the authors creating touchDefense with it.

Also see the cocos2d tag on one of the touchDefense authors’ blog … and on the other one’s too. Particuarly this post and source project about sprite colouring.

Here is a tutorial series covering setup through collisions and particle systems; also check out others with the cocos2d tag on that blog.

Cocos2d: Bouncing Ball Example is a walkthrough of creating a scripted animation.

Cocos2d Example – Bouncing Ball is, oddly enough, completely different than the last one, a walkthrough of creating non-scripted animation!

Scripting cocos2d-iPhone actions with XML is for your really hard-core scripting needs.

This fellow has open sourced his ABC123 game and a tile based game shell with accompanying tile map editor; see lots of good blog posts as well. Not to mention a cocos Live WordPress plugin, of all things.

Gorillas is another open sourced cocos2d game.

In case you missed it in the discussion links above, more sample games and miscellaneous files can be found at cocos2d-iphone-discuss.

Texture Atlas Creator is a nifty web application for, well, creating texture atlases, eponymously enough.

Speaking of which, Using Cocos2D AtlasSpriteManager has useful advice on using them.

Making Seamless Repeating Backgrounds is a helpful tutorial.

The SilentMac Design blog has some good cocos-tagged entries too.

Cocos2d Iphone Dynamically Touch Detection has some advice on implementing touchable sprites.

An introduction to game physics with Chipmunk gives you an excellent tutorial on the physics engine that comes with cocos2d.

If you like videos, here’s a Hello World app creation walkthrough.

And there’s various project templates in the above links, but here’s another and yet another on github. And even yet another on Google Code. And yet^4 another … and yet^5 another … they’re just everywhere!

… and finally, here is a bit of amusement for you. Remember when we posted that 3D engine roundup, and said “we’re definitely going to follow his experiences with the engines of choice!” Well, here’s your followup: he ended up using cocos2d with the Box2d engine port!

Over Easter I decided to drop a dimension in my iPhone project to go from a 3D evolution game simulator to 2D… It was obvious that cocos2d had already solved the problem of a simple game engine, and then some.

I was decided. The rapid progress I was able to affect in 2D with both chipmunk and box2d as well as the ready-to-exploit and well documented cocos2d game engine convinced me…

Well, with an endorsement like that, we know we’re on the right track here, yes?


BIT-101 Blog has some useful posts on curves, colors, menus, … cocos2d tutorials gathered here!

Any more to suggest, Dear Readers?]

Continue Reading →
Page 80 of 100 «...5060707879808182...»