Under the Bridge

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 →
0

POssO

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

posso

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 →
0

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?

kickstart

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

Anewway

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 http://glyphish.com 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 →
2

Style guides

So, you ever looked at your project with old stuff and new stuff and samples borrowed from hither and yon and thought “sheesh, I seriously need to sort out a consistent style here?” Yeah, us too. So here’s a list of resources to help you out with that.

As always, start at the mothership and check out Coding Guidelines For Cocoa and The Objective-C 2.0 Programming Language.

Then, visit CocoaDevCentral for Coca Style For Objective-C, with a second part as well.

Got some strong opinions now? Good, it’s time to read through this thread on the possible pitfalls that await a poorly chosen strategy of variable naming.

And whether you agree with them or not, it would behoove you to be familiar with the practices in the Google Objective-C Style Guide, part of the google-styleguide project to document the practices used in Google code.

That we believe is a fairly comprehensive rundown of Objective-C focused resources, but then there’s the style of the non-objective bits of C and C++ that will probably be part of your projects as well; and there’s quite a bit more of that around. But a quite sufficient resource for that can be found at this archive of coding style documents. And if nothing you find there fits quite right, why, here is a generator for your own personal style document. We must find some time to play with that one of these days!

[EDIT: And for actively beautifying code, check out this post on use of uncrustify with Xcode!]

Continue Reading →
0

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!

coredata

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

Continue Reading →
3

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 →
0

Snippet: Singletons

So there was this thread about using the Singleton pattern, and it went right quick into the usual whining about it being an anti-pattern and all, but there were a couple interesting links that turned up:

Singletons, AppDelegates and top-level Data is a good Cocoa-centric overview of the topic, and we direct your attention particularly to the SynthesizeSingleton.h header provided, which macroizes all the support you’d need if you wanted to use a singleton with conventional allocation semantics. Which strikes us as unlikely, but hey.

The interesting part though is the allocation question. The above-linked file relies on the @synchronized directive in allocation, which we think is a little unwieldy, as well as being Objective-C 2.0 dependent. So how to ensure thread safety then? Interesting discussions here, and here, and here, and here; that OSAtomicCompareAndSwapPtrBarrier idea strikes us as particularly nifty.

But here’s our idiom for setting up singletons; just do it at static initialization time, like this for initializing application settings:

static PMPESettings* _sSharedSettings = [PMPESettings sharedSettings];
@implementation PMPESettings


+ (void)initialize
{
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
[[self sharedSettings] load];
[pool release];
}


+ (PMPESettings *)sharedSettings
{
if (!_sSharedSettings)
_sSharedSettings = [[self alloc] init];
return _sSharedSettings;
}


- (void)load
{
... if there aren't any saved settings, fill in defaults...
}

@end

So long as we’re not doing ridiculous things at static initialization time — and oh boy, have we got some stories we could tell you about things we had to port that were completely dependent on Visual Studio’s link order! — but just sorting things into usable states, like above where -load creates default application preference values when none exist, this seems to me to be a perfectly reasonable way to leverage compiler and Objective-C semantics to sidestep synchronization worries completely. What do you all think?

h/t: iPhoneSDK!

UPDATES:

And if you want to read lots of advice on singleton implementation…

Ship-It Saturday: PRHEmptySingleton repository

Objective-C Singleton Class Template

Everyone has a singleton, and this is mine

How I do my singletons

Require OS 4? Hey, guaranteed alloc safety: Singletons: You’re doing them wrong

This looks like pretty much the final, universally compatible, word on the subject: Objective-C Singleton

Continue Reading →
0

Tips: Localization

Heh. This fellow with, apparently, way too much time on his hands went digging around in AppKit and found out that there’s an undocumented call _NXKitString that lets you cheat on your localizations by accessing AppKit.framework’s tables directly.

Now, we really really don’t recommend you ever ship anything using that, but it is interesting to note the source of these tables:

To see what’s there, navigate to the following location:

/System/Library/Frameworks/AppKit.framework/Versions/C/Resources/

From there, you can navigate into the English.lproj directory, for example, where you’ll see a list of string table files, all of which have the suffix “strings”. These represent the allowable table names that you pass to _NXKitString. So, “Preferences” maps to Preferences.strings and so on.

So not only can you save yourself some pennies on your own translation costs by digging through there, far more importantly, for any particular string that happens to be there, you can get The Official Apple-Approved translation … as opposed to the real howlers completely inconsistent with the rest of the system that your commissioned translators have a way of throwing at you, one finds on occasion. Because they always claim yes we are completely familiar with Apple conventions in all the languages you want … but that does not always turn out to indeed be the case.

While we’re discussing localization, if you have 23 localizations to spit out RIGHT NOW! like some of us do, here is a new addition to our Invaluable Development Tools list, LangSwitch:

The only boring and time-consuming solution is to thoroughly test the new UI in every localization before releasing. This is especially time-consuming as you have to change the language settings in System Preferences every time you want to change the localization.

Also, another downside of this is that it changes your whole computer (well, just your session, but whatever…). I personally don’t really like to use a computer in Chinese…

That’s where LangSwitch comes in… It gives you a simple GUI way to switch the localization for only the app you’re testing. It displays only the localizations avaiable for your app. Here’s an easy way to test your different localizations without the hassle.

Is that sweet, or what? Works just as described, and somehow manages to maintain the designated localization even after an Xcode Clean All and rebuild. Not completely sure just how it’s managing that, but it’s certainly a useful trick!

And here’s a useful little tip for the use of genstrings if you like, as we do, to organize your source in folders; this command will recurse two levels down your hierarchy to pull out all your source strings:

genstrings *[hmc] */*[hmc] */*/*[hmc]

To finish off, here’s a few other recent useful posts regarding localization you may wish to also read over if this happens to be a concern of yours at the moment:

ibtool: Localization Made Easier

Localizing iPhone Apps – Internationalization

Cocoa Localization Guide

[EDIT: And here is a web service that might be worth your looking into!]

Continue Reading →
5

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 {
	if(UIInterfaceOrientationIsLandscape(self.interfaceOrientation)){
		[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);
		self.view.center = CGPointMake(160.0f, 240.0f);
		[UIView commitAnimations];
	}
}

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

h/t: iPhoneSDK!

Continue Reading →
0

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:

shark

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 →
0
Page 91 of 114 «...6070808990919293...»