Archive for 'iPhone'

Tools: Clang

So we’ve mentioned the LLVM/Clang Static Analyzer already in passing, but there’s enough resources springing up all over to merit some more attention:

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 →

Tip: iPhone Virtual Memory

“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. mmap FTW!

h/t: iPhoneKicks!

Continue Reading →

Code: GLGestureRecognizer

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 →


Ah, here’s another fine job well done: “POssO” the one and only OpenSSO administration application for the iPhone is now live!


POssO adds the much desired remote management feature to your corporate identity management infrastructure, enabling you to achieve better efficiency and accessibility in your organization.

With features like:

1. Create Identities

2. Manage Identities

3. Search Identities

4. Password Management

5. Role Management

6. Policy Management

7. Session Management

8. Cisco VPN Client Support

You can manage your corporate profile remotely adding flexibility to your schedule. It will revolutionalize the way you manage your corporate identity management infrastructure.

Rather narrowly targeted, yes, but hey if you have a use for it … grab it now!

Get POssO

And we’re particularly tickled to note that after more than a dozen applications, the TrollSheep has finally made it into the UI for one of them … check the credits!

Continue Reading →

Pledging for icons

As you may have noted previously, the artistic skills are not ones of noted accomplishment by trolls. (Aside, that is, from performance art. We’re real good at that, as pretty much anyone who’s met us will attest, we trust.) So we were pleased as punch to stumble across this cleverly named site with a set of nice-looking free UIToolbar/UITabBar icons! We’ll download those immediately, yes…

But wait, what’s this over on the side?


a “kickstart”? What is a “kickstart”? Well, it turns out that is


Kickstarter is a funding platform for artists, designers, filmmakers, musicians, journalists, inventors, bloggers, explorers…

Now that’s intriguing, isn’t it? Here’s the details, but the basic upshot is it’s a website for organizing pledge drives. If enough people sign up to reach the pledge amount, everyone pays their pledge, if not, no one does. An interesting concept, and certainly looks like it has more potential than a donationware model.

So the designer fellow has a project page there where he offers rewards for various levels of pledging, starting with

I make cool icons for iPhone developers at and if I can collect $500 in donations, I’ll release the whole set of icons in vector format (SVG + Illustrator) for use in apps, posters, tshirts, whatever!

And that has worked out pretty well for him; it was up to $685 when we arrived, and hey we did think the icons were pretty nice and we were curious to try this Kickstart thing out besides, so we kicked in $20 to see how it went. Which was smoothly. So the nifty idea here appears to be implemented competently, which is always a nice bonus.

So, that certainly is an interesting alternative to consider for funding your development … or anything else … isn’t it? There’s a wide variety of different kinds of projects to explore, but we note with particular interest this project to accumulate enough pledges to remove ads from this iGoozex app. Which, well, we have no use for ourselves, but we’ll certainly be checking back to see how that works out for this fellow with people who do, and if it looks like this concept has some hope of working for developers as well as artists, we’ll see about trying this idea out for some project of our own perhaps. It certainly would be a nifty way of prejudging actual user interest in an application concept!

Continue Reading →

Resources: Core Data

So not all that long ago we put together a list of resources for getting into the gritty details of SQLite for your iPhone data management needs. And as chances are you’ve heard, that’s all unnecessary now because the awesomeness which is Core Data will be available on iPhone OS 3.o. Sooooo, as soon as you can target OS 3+ only, it behooves you to get up to speed on it!

First off, here’s a brief concepts overview to get you started.

Then visit Cocoa Dev Central for the exceedingly worthwhile Class Overview and sample application walkthrough.

Then go trawl the mothership for Officially Sanctioned resources, starting with the Programming Guide.

As always, cocoadev is a great resource for anything related to Cocoa, and Core Data is no exception.

A variety of interesting Core Data posts at Cocoa With Love.

And another good collection at Cocoa Is My Girlfriend.

And speaking of CIMGF, the great folks at Pragmatic (have you got their Core Animation book yet?) are bringing out a book on Core Data in the near future by Marcus Zarra of that blog, and based on what we’ve seen from all involved so far we’ll just go out on a limb here and recommend that you’re absolutely certain to find it invaluable and you should just click the picture and preorder it NOW!


[EDIT: And there's a new tutorial series starting here that looks worth following as well.]

Continue Reading →

Tutorial: JSON over HTTP

We’ve mentioned the json-framework project before; but here’s an excellent tutorial on how exactly to use it that you really should not miss if that’s something you need to do.

Also note this other alternative, ObjectiveResource, which handles both XML and JSON deserialization in the context of interacting with Ruby on Rails applications, a port of Ruby’s ActiveResource apparently…

h/t: iPhoneKicks!

Continue Reading →

Snippet: Orientation

Here’s a useful post on dealing with interface orientation changes:

One of the features with which I had to get fairly intimate with on the iPhone over the last couple of months was working with orientation changes. At first my code was completely incorrect and it wasn’t immediately obvious to me how to get my application to reorient itself properly. This was mainly due to the structure of my code. In this post I am going to explain a simple, memory efficient way of working with UIViewController and interface orientation changes.

We draw your attention particularly to the ‘Pitfalls’ discussion:

… I did have an issue where I was using 3 view controllers. Let’s call them A, B and C. A switched to B and vice-versa when the phone’s orientation changed. C was loaded by B and was viewable in landscape and portrait orientations. The problem came in where if you changed C’s orientation and then the user navigated back to B where B had a different orientation, you would effectively not be notified of an orientation change. If you subsequently changed B’s orientation to load A, you would find A would load in the wrong orientation. Oops, bug…

So how did I solve this? Well all I did was put this piece of code in A so that it would manually reorient itself from portrait to landscape:

- (void)viewDidAppear:(BOOL)animated {
		[UIView beginAnimations:@”View Flip” context:nil];
		[UIView setAnimationDuration:0.5f];
		[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
		self.view.transform = CGAffineTransformIdentity;
		self.view.transform = 
			CGAffineTransformMakeRotation(MPI * (90) / 180.0);
		self.view.bounds = CGRectMake(0.0f, 0.0f, 480.0f, 320.0f); = CGPointMake(160.0f, 240.0f);
		[UIView commitAnimations];

That’s a handy little snippet to keep in mind, indeed.

h/t: iPhoneSDK!

Continue Reading →

Tools: Shark

So if you’ve been doing Mac programming for a while, you’re probably aware that Shark is a tool of veritably godlike omniscience when it comes to profiling your application and finding out just what it is that needs optimization. But were you aware that you can do on-iPhone application profiling with it as well? 

Well, maybe you were, but we weren’t. And if you weren’t either, here’s how you do it to get all the source codey goodness of Shark handily:

1) Run your application from within Xcode on the device.

2) Start up Shark (/Developer/Applications/Performance Tools/ is where it lives).

3) Select “Network/iPhone Profiling…” from the Sampling menu.

4) Sort out the resulting dialog as explained here so it looks like this:


Note that this demonstrates Vital Tip #1: Select the particular process of interest, do NOT leave ‘Target’ atthe default of ‘Everything’. We tried that at first, since hey it’d be neat to see the complete list of what’s going on, logged for about 40 seconds … and eleven hours later, it was still chugging away with “Shared devices processing samples” without even having figured out how much work there was to do to get the progress bar started. Yeah, alright then, we won’t do that, will we.

After sorting that out, it’s a matter of a few minutes to get what looks like all the same information from your iPhone app that you can for your desktop apps. It’s amazing what you can find if you just think to actually look, isn’t it now?

Continue Reading →

UIWebView tips

Here’s a useful collection of tips on using UIWebView:

- Loading the SVG file from your resources folder
- UIWebView loading contents when it is off-screen
- Calling a javascript function from Objective-C
- Javascript communicating back with Objective-C code
- Disabling the selection flash
- Disabling the “action” pop-up
- Disabling default zoom effect

Something there for everybody. And here’s one more:

Common problem, need to apply nice HTML formatting for a section of your page, but want the UIWebView not to appear as a big white box – only the content of the UIWebView to appear. How to do it?

myWebView.opaque = NO;
myWebView.backgroundColor = [UIColor clearColor];
[myWebView loadHTMLString:
@"<html><body style='background-color: transparent'>
       Content Here</body></html>" baseURL:nil];

Now you know!

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