Archive for January, 2010

30
Jan

DDG Reachability

So as you no doubt know if you’ve been reading us for a while, your iPhone programs need to go figure out for themselves the status of the network connection before using it in any way if they don’t want to be rejected, and the Reachability sample is … well, 2.0 is better than it was, let’s leave it there. (There’s a good post on its use here too.)

But ho! Here’s a fellow who’s taken it on himself to do something about it with a refactored/extended Reachability and extensive documentation:

… While the 2.0 version of this code is much better than v1.5, it is still quite raw. (For example, there is a bare [super init]; in a class method [line 175 in Reachability.m]. It does nothing. It also has two routines with misspellings in their names: -startNotifer/-stopNotifer should be -startNotifier/-stopNotifier) To me, these are signs of raw code. To remedy this, I have significantly reengineered this class.

I had three goals when starting this process. First, I wanted to understand how to use this code. It isn’t at all apparent how these routines should be used. What order should they be called in and what do the various tests and values mean? Second, my scan of the code convinced me that it was written by a low level network engineer. They had made implementation decisions that were not terribly friendly to using it in a Cocoa Touch program. I wanted a class that fit in with my coding style. Third, because the core network testing routine -networkStatusForFlags: was not, in my opinion, clear, I did not feel comfortable shipping it in my app, weLost™. I wanted to have confidence in this code…

We love that kind of people. At writing his latest (BSD-licensed) version, with the Apple original, is at Reachability 2.0.4ddg.zip. Enjoy!

h/t: iPhoneSDK!

29
Jan

OpenAL SoundManager

If you’re looking at using OpenAL in your iPhone project, you probably want to check out the handy wrapper here.

I’ve finally managed to upload the latest version of the SoundManager class. This is the same version I am using in Sir Lamorak’s Quest. There are a few changes from the class in the tutorials…

Which I presume is the tutorial linked here. But the source looks pretty straightforward, and a big leg up on puzzling through OpenAL on your own!

28
Jan

Snippet: AppStore Reviews

Here’s a little snippet showing you how to open the App Store to your reviews page from the application:

- (IBAction)gotoReviews:(id)sender
{
NSString *str = @"itms-apps://ax.itunes.apple.com/WebObjects/MZStore.woa";
str = [NSString stringWithFormat:@"%@/wa/viewContentsUserReviews?", str];
str = [NSString stringWithFormat:@"%@type=Purple+Software&id=", str];
// Here is the app id from itunesconnect
str = [NSString stringWithFormat:@"%@289382458", str];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:str]];
}

Happy users are the best social proof!

27
Jan

iPad SDK

So no doubt you noticed that this new toy from Apple padded (heh) out on stage today and all. Kinda looks like someone held up a magnifying glass to an iPod touch and said “A NEW PRODUCT!!!” doesn’t it?

We kid, we kid. Well, sorta. With no multitasking or camera, that actually is a pretty concise description of it. And is there really a market for a $500-$1000 (which it will be once you get a case and keyboard for the top end model) big-ass iPod? Well, we shall see as we watch with interest … not as much as the Kindle folks are though, I’ll betcha!

Speaking of which, looks so far like we were probably wrong about a new HTML5-based content developmnt environment; it was stated that the book store is simply using the EPUB (“EPub”, “ePub”, …) format. Which is kinda-sorta HTML. However, it was also stated that you could have pictures and video in your iBooks … which certainly seems to imply that there’ll be HTML5 extensions to support that at least. Sooooo, we may not have been completely wrong. But we shall see.

And it was a just barely noticeable surprise that iPad Safari won’t support the Flash plugin either, since the “it’s not the real Internet if I can’t play my Flash games” argument is slightly more serious on a page-sized browsing device than it is for a pocket-sized device. But it seems that John Gruber’s analysis is pretty much spot on there.

However, we were completely right in taking it as a too-obvious-to-bother-posting given that the OS would be a somewhat extended iPhone OS, not a stripped down OS X, or something new; although it was a mild surprise to find that apparently there’s still no multitasking available. The SDK is currently in beta and under The Felicitous NDA that should come as no surprise; however, here’s a fellow who doesn’t take his agreement very seriously…

[UPDATE: No, Apple Legal, calm down, it was all a big oversight. So we've removed our quotation too, snip snip snip]

…. But the executive summary is, it’s a fairly subtle set of extensions to the regular iPhone development process, so branching out into iPad development will be no big deal for any iPhone developer. And hey, we always love a completely defensible excuse to buy a new toy!

h/t: iPhoneFlow!

26
Jan

AR Sudoku

Now here is some seriously nifty niftiness: how to do augmented reality on the iPhone. Specifically, sudoku. Printed sudoku. Seriously. Like this:

sudokugrab.png

OK, we know how to overlay images on the feed … but how the @(#$&@^!! does he do THAT?

Well, turns out that one of the things we missed while we were off wandering the Orient … the very day we left, actually … was that now you’re legally allowed to access the screen contents with UIGetScreenImage().

Sheesh. Just can’t take your eye off the ball for a second in this iPhone programming world, can you?

Any-ways, once you get past that formerly illegal bit, there’s still a lot of pixel pushing and math to get through to do anything useful. The article has lots of nicely explained code and a handy sample app to get you started on AR magic!

h/t: iPhoneSDK!

23
Jan

FlowerGarden

Here’s a post worth reading about the marketing travails of a cute little iPhone app called FlowerGarden:

Making A Living (Barely) On The iPhone App Store (aka The Numbers Post)

The App Store is a very hit-driven environment. A few apps sell a large amount of units, and the great majority sell next to nothing. That’s somewhat similar to the music industry, except that the audience for music is much larger, so both the big hits and the small players get more sales. We’ve drooled over the numbers chart toppers sold, we’ve seen sales reports of very successful games, and we’ve also seen what happens when apps languish at the bottom.

I want to share the sales data for Flower Garden. Not just the raw data, but a bit of the story behind it, my thoughts, struggles, and why things happened the way they did…

Worth reading start to finish, as any hard data on sales figures always is, but the particularly interesting bit is that there’s some hard data on the experience of adding in-app purchase to both free and paid versions of Flower Garden. There isn’t much out there yet on people’s experiences with IAP — if you know of any, please share — but going by this fellow’s experience it looks like it’s a pretty good idea. Which reinforces our intention to getting around to implementing an IAP version of our Poses line Real Soon Now!

21
Jan

PDF Content

So, if you’ve been putting any PDF content in your iPhone apps, you — like us — probably fall into the category described here:

PDF parsing is a black art that most programmers avoid. “Madness lurks here.” They mumble to themselves quietly. Choosing instead to push their PDFs through UIWebViews and commit other crimes against humanity…

Well, we’d call it “path of least resistance” rather than “crimes against humanity” per se … but essentially yes.

… It doesn’t have to be this way, however. Parsing, displaying, and searching PDFs natively and at a low level is actually surprisingly easy if you’re not afraid to get your hands a little dirty with the Core Graphics PDF functions. I’m going to show you how.

And, indeed, it actually is not all that hard to display PDFs using Core Graphics. Still harder than UIWebView, mind you, so why bother? Why, because if you’re controlling the display and pagination, you can integrate the search engine strategy the post goes on to describe:

One of the things that seems to be particularly scary to programmers is searching PDFs. I agree that it’s certainly not pleasant stuff to code, but it’s not hard either.

Now, I want to preface this by saying that I feel this code is a bit of a hack, but it definitely works, and seems to work quite well…

Perhaps not the most confidence-inspiring of attestations, but hey it’s code you don’t have to write, and that’s always the best kind, isn’t it now?

h/t: iPhoneSDK!

UPDATE:

Another take on the process here:

Rendering PDF is easier than you thought

19
Jan

PastryKit

So, since apparently it’s the thing to do these days to throw out wild guesses about what’s coming down the pike next week from Apple, we’ll toss in our almost completely baseless prognostications to join the crowd. Specifically, we’re going to predict that there’s going to be a new development environment released to support the creation of print content for The Mystery Device, and it’s going to be based on HTML5.

Furthermore, whilst there’s certainly no shortage of JavaScript frameworks from Apple that could be used for this, we’ll bet that it’s going to be based on PastryKit.

Oh, you’ve missed that PastryKit thingy? Well, it’s not officially acknowledged, and the first mention of it anywhere appears to be this StackOverflow thread. It came to general attention when the esteemed John Gruber waxed poetic on Daring Fireball about it; that set off a minor feeding frenzy of digging deeper into it all over teh intertubes, like here, and here, and here.

The thing that really gets our spidey sense tingling is that PastryKit is fairly self-evidently the basis for TuneKit, the official method for creating iTunes LP and iTunes Extras for the desktop and for Apple TV. It just kinda seems to follow to us that the technology they’d pick for that is one that they’ve got bigger plans for. Like, doing to the mobile visual content marketplace what they’ve done to the mobile audio and application content marketplaces — that is, pwned them completely,

Apple responsible for 99.4% of mobile app sales in 2009

iTunes Beats All with 69% Digital [Music] Market Share

in case you’ve been in a coma or something.

So really, even without the various leaks from content providers pointing that way, it does follow that Apple would be working on assimilating magazine and book publishers … because, when you think about it, who else is there left for them to go after? But you’re not going to have each content provider write their own application like on the iPhone’s App Store, you’re going to have a content framework for them to design to. And it just seems like a pretty darn good bet that the above-referenced TuneKit is the first step in that direction; and it also fits with the kind of application that the PastryKit sightings in the wild have been in connection with.

On the other hand, we could be completely wrong. You’ll be able to check next week!

17
Jan

SwapKit – URL IPC library

So here’s another kick at the can at jumpstarting the use of application URL handlers for iPhone app IPC, as we’ve mentioned before — and this one’s looking pretty ambitious. The name is SwapKit, and the announcement thread is here:

SwapKit is a MIT-licensed library to allow locally installed iPhone apps to share data among themselves. It supplies facilities iPhone OS does not provide, including shared metadata on installed apps, binding applications to data types and app capabilities (similar to how apps in desktop OSes bind themselves to file types), and providing one-way and (planned) two-way communication to let apps collaborate and do more than any single one could ever hope to.

SwapKit requires no app to be installed except for your very own, or anything else from me except the code (and that’s completely free and infinitely forkable for your pleasure). And all of the above is done in a 100% App Store-friendly fashion.

In case it’s not completely clear why you’d bother with this, it’s to build an opt-in version of the other applications’ capabilities lists available on desktop OS X , like the “Open with:” list you can see in the Finder’s info windows for a document, essentially.

An end to hardcoding “What app would you like to use to open this link”/”What Twitter client do you want to use”/etc. preference items, since you can now see what SwapKit apps are there and fill the menu dynamically.

So hey, if you are writing an app that wants to play with others, throw support for SwapKit in!

15
Jan

Simulating Apps

So let’s say that you’ve been reading about making demo videos for your app using the simulator, and figure yeah, that sounds like a good idea … but OH NOES! The workflow you want to show involves native applications like Maps that don’t run in the simulator! What to do? What to do?

Well, those savants over at Mobile Orchard are on the case for you.

… However, when the app is run on iPhone Simulator, Safari is launched and a standard Google Maps webpage is loaded. A similar effect can be accomplished in iPhone Simulator by creating a mock Maps application that uses screen shots taken from the native Maps application on the iPhone.

Creating and using a mock application involves three steps:

1. Capture screen shots from the native application on the device.

2. Download a mock application from GitHub and customize it.

3. Create a demo build of your application to launch the mock application instead of the native one.

Sounds like a pretty big time sink, yes? Well, not really, the article provides a pretty complete-looking tutorial and code for a mock application, so hey if you have something that you were just chomping at the bit to do a video of, check it out!