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 →
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.
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 →
So there was this thread on iPhoneSDK where a fellow was wondering what UIColor to use to imitate Settings.app’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 TWUIColors.zip and check for yourself!
bfeher/BFPaperColors: “Flat colors taken from Google’s Paper Material Design.”Continue Reading →
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 Settings.app
- 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 Settings.app
h/t: iPhoneSDK!Continue Reading →
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"
Yes, never forget that AppleScript is usable from the command line!]Continue Reading →
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…
… 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.
mattt / Godzippa: “GZip Compression / Decompression Category for NSData”.Continue Reading →
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!
cocos2d-iphone.org is the official center for all things cocos2d.
[UPDATE: Due to massive Google suckage, the community is now a bbPress forum!]
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
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.
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?
Any more to suggest, Dear Readers?]Continue Reading →
Bug Finding With Clang: 5 Resources To Get You Started has usefully descriptive links.
Automated Clang From Xcode has an AppleScript to enhance the convenience.
And for the ultimate in convenience, here is AnalysisTool: a GUI application which allows running both official and their custom analyses!
Well, we wouldn’t want to recommend anything without actual personal experience, so let’s run it over the project we submitted to Apple end of last week…
… OMFG!! 145 — ONE HUNDRED FORTY-FIVE — BUGS!! OK, deep breaths, deep breaths, let’s look at what they are. OK, those are in libvorbis, not actually a problem; and these are in libfaac, nothing immediately fatal there either; and libflac has some too, again no need to panic; and precisely one (a shadowed variable in framing.c, since you asked) in libogg.
And in my source … not a single one. No, not ‘just false positives’, actually no not a single quibble anywhere. We’re not completely certain if that makes us actually as clever as we’d like you to think we are, or just utterly OCD on our coding hygiene. Of course, there’s always the both option isn’t there?
In any case, we thoroughly recommend that no matter what you’re programming for, you familiarize yourself with Clang!Continue Reading →
“What?” you’re no doubt thinking, “is he going on about? Everyone knows there’s no virtual memory on the iPhone!”
Ah, young padawan, let us correct your misconception. It turns out that, indeed, there actually is. Take a look through this moderately amusing rant about the indeterminacy of memory allotments on the iPhone and into the comments. There’s a variety of suggestions about killing other processes, hogging memory to your own process, and in general going out of your way to not play nice with others; which, well, that’s not the iPhone way, is it now? But then, there’s this piece of solid gold:
There actually is a virtual memory system pager. However you have to manually set it up.
Search for ‘mmap’ in Apple’s iPhone Developer Forum and you’ll find a very informative thread.
Basically, it works like this: In place of malloc, you create a file of the appropriate size and then memory map that file using mmap. The virtual memory pager will page in and out the memory pages as needed. This works both for read-only data (you can just use [NSData dataWithContentsOfMappedFile: ] for that) as well as read-write memory.
Woah. We were utterly and completely unaware that was supported on the iPhone.
h/t: iPhoneKicks!Continue Reading →
This looks nifty; a gesture recognition implementation for the iPhone!
GLGestureRecognizer is a Objective-C implementation of the $1 Unistroke Recognizer, a simple gesture recognition algorithm. It was implemented over the course of a couple evenings in late April 2009 by Adam Preble.
Not that we actually have any immediate use for it, but hey in case something comes up, the code is on github and open source, so there you go!
[EDIT: And the very next day, Mobile Orchard has a post on iPhone Circle Gesture Detection too!]Continue Reading →