Simple iOS Networking with ThoMoNetworking

ThoMoNetworking by Thorsten Karrer and Moritz Wittenhagen is a dead simple Objective-C class to handle client/server communication on a local network via Bonjour, for both Mac and iPhone/iPad development. It handles clients finding servers on a LAN without needing to exchange IP addresses and ports and deals with dropped connections and uses asynchronous network calls with threading.

Setting up a server and sending out messages to connected clients is just a couple of lines:

-(void)setupServer {
   // Assume myServer exists
   myServer = [[ThoMoServerStub alloc] initWithProtocolIdentifier:@"helloThoMo"];

   [myServer start];
}

// Send a string to all our clients
-(void)sendString:(NSString *)aString {
   [myServer sendToAllClients:aString];
}

The client then starts listening and a delegate is defined to send a message to when requests are received:

-(void)setupClient {
   // Assume myClient exists
   myClient = [[ThoMoClientStub alloc] initWithProtocolIdentifier:@"helloThoMo"];
   [myClient setDelegate:self];
   [myClient start];
}

// This is our delegate method where we receive data from our server
-(void)client:(ThoMoClientStub *)theClient didReceiveData:(id)theData fromServer:(NSString *)aServerIdString; {
   NSLog(@"%@ sent me a message: %@", aServerIdString, theData);
}

There are a few limitations, which are discussed on the developer’s site (via Under the Bridge).

Posted in Code | Tagged intermediate, networking | Leave a comment

Goodie Roundup – August 3rd, 2010

Interesting iPhone and iPad development, design or even marketing items. Often new, sometimes old.

  • NetNewsWire developer Brent Simmons has posted his RSTwitterCallGetXAuthAccessToken helper class to help Twitter app developers using xAuth get OAuth access tokens when calling the Twitter API.
  • Ray Wenderlich explains how to host a beta test for your iOS app. Big thing to keep in mind is you can only authorize 100 devices a year for ad-hoc distributions, and these aren’t just specific to one app under your developer account!
  • A little while back, Mike Rundle showed how he implemented a custom UIScrollView menu in his Digital Post app.
  • Matt Coneybeare provided some code snippets on how to spruce up your tables by adding custom gradient backgrounds in a UITableView.

Have a goodie to share? Send it in!

Posted in Goodie Roundup | 1 Comment

Xcode 4 Git Tip — The current beta of Xcode 4 expects git to live in /usr/bin, so create a symlink if you don’t have a copy there. Also, no native SSH or GitHub protocol support yet it seems. 8/3/10

Pull to Refresh, this Time in JavaScript

Not satisfied with all the solutions available for pull to refresh in native code? Wayne Pan has a solution for developers of iPhone mobile web apps built in JavaScript. See the implementation below, or look at a demo in Mobile Safari.

(via Webmonkey)

Posted in Code | Tagged interface, pull to refresh, web app | Leave a comment

NSCampfire — Speaking of iPhone conferences, NSCampfire is a directory for Cocoa, iPhone, iPad, and iPod developers and companies to list their conference, seminar or training events. 8/3/10

Being Geek PDF Available Today Only for $9.99 — It’s not strictly iPhone development related, but a topic that every software developer faces at some point in their career: do you want to be writing code for the Man for the rest of your life? Become a manager? Do you own thing? From the author of Managing Humans, Being Geek: The Software Developer’s Career Handbook by Michael Lopp (@rands) is available today (Tuesday) only for $9.99 with code DDGEK as a DRM free PDF from O’Reilly. Discover a fresh $9.99 deal every weekday from O’Reilly via this feed. 8/3/10

iPhone and iPad UX Review Site and Upcoming Book

Suzanne Ginsburg is a user experience consultant who helps companies large and small conceptualize and design iOS software. Her book Designing the iPhone User Experience: A User-Centered Approach to Sketching and Prototyping iPhone Apps is due out at the end of August. From the publisher:

Successful iPhone developers create apps that are a pleasure to use: intuitive, easy, powerful, and, above all, useful. This requires far more than programming chops. Developers must have a clear understanding of user needs, as well as deft planning, visualization, and usability-testing skills. Leading user-experience expert Suzanne Ginsburg brings together all the skills and insights you need to build the ultimate iPhone user experience. In Designing the iPhone User Experience, Ginsburg shows you how to gain a deep understanding of your users, translate user needs into design solutions, and evaluate your designs through usability testing.

If you can’t wait until then, she also runs a blog on iOS UX, where recent topics like 10 Design Principles for eReader Apps, Purchasing iPad Books: iBooks, Kindle, Kobo and comparisons of New York Times vs. USA Today and Gowalla vs foursquare were featured.

You can follow Suzanne on Twitter and hear here speak online on August 25th at the iPhone/iPad Summit (register with code IPPSGINSBURG for 10% off).

Posted in Design | Tagged book, interface | Leave a comment

Goodie Roundup – August 2nd, 2010

Interesting iPhone and iPad development, design or even marketing items. Often new, sometimes old.

Have a goodie to share? Send it in!

Posted in Goodie Roundup | 2 Comments

Voices That Matter Fall 2010 iPhone Developer’s Conference — Just announced is this October 16th – 17th, 2010 event in Philadelphia, featuring popular iOS and Mac development authors like including Aaron Hillegass, Jeff LaMarche, Steve Kochan and Erica Sadun. Early bird registration is currently $495. Don’t miss the full list of remaining 2010 iOS events. 8/2/10

PullToRefreshGate — Following another implementation of (almost) everyone’s favorite Tweetie feature, pull to refresh, this time by Leah Culver, developer Justin expressed his dislike for the increasingly copied UI choice that could easily be implemented with a simple button. Jeff LaMarche chimes in to its defense, citing its easy one thumb use and Instapaper author Marco Arment thinks many won’t use it properly. 8/2/10