Earlier this week, ESPN launched the ESPN Developer Center, solidifying the geekiness of sports with the geekiness of technology.
For all you tech types out there that take pride in not knowing anything about sports, this is potentially a pretty big deal. ESPN is the ‘worldwide leader in sports’ and has a vast store of information, both current and historical, about all major sports (even hockey).
weinre. A rather odd accronym indeed. It could be pronounced why • ner • ree.
Or wee • ner (which my training of the English language biases me towards).
weinre. Web Inspector Remote. This is what happens when developers make and market a product.
weinre.
Weinre is a tool for remotely debugging your web pages. Let’s say you’re building a responsive web site or a mobile web app. iOS’s Debug Console certainly can’t be the most helpful option for peeking behind the curtain. This is where weinre comes in.
Recently being brought into the Phonegap fold (and therefore Apache and the Apache Incubator), weinre is undergoing active development. You can learn about weinre at phonegap.github.com/weinre/Home.html or callback.github.com/callback-weiner (callback is the Apache Incubator github account).
Here, you’ll learn that if you’re on OSX there is an app to get you up and running fast. You’ll learn that it’s a javascript-only implementation of the Webkit Inspector. You’ll learn that there are three parts (each with the word “Debug” in it’s name). But what you won’t learn is how to open up your localhost development server to outside devices. For that you came here.
To begin using weinre to remotely debug your projects, simply follow this six step program.
Apple has allowed iOS apps to register their own URL schemes on your devices for a while now, but I’ve never used this functionality in-depth ’till just recently.
Having your app register a URL scheme on a device means that you can open an installed application on a user’s iPhone or iPad in ONE CLICK from their email (or the web, or another application). There are all sorts of apps already using this functionality.
Use Case
We just used this for a project where the client would send confirmation emails to the user after signup. The email would contain an link to a URL. The URL opens in mobile Safari, then launches the app and seamlessly logs the user into the app.
That’s one use case; there’s probably others (let us know yours). Another one could be a URL embeded in text—say someone is reading on their iPad and the content could prompt them to hop over to the app.
Try It Out
If a user has your app installed on their device, all you have to do is send them to my-great-app://whatever/ and Safari will resign to the background and your app will open. Why don’t you try it? I know you’ve got the Facebook app installed on your iPhone. Just clear your address bar and type (or click the link): fb://profile
Go ahead, I’ll wait.
It opened the Facebook app and took you to your profile page (or gave you a big fat cryptic error message if you don’t have the Facebook app installed). Facebook allows a LOT of options that you can pass to the application to take you into various parts of the app.
Process
So enough about the Facebook app. What does a developer do if they want to pass a bunch of data to the app—without actually defining what needs to be passed using a bunch of if/else or switch statements?
It’s fairly trivial to add url scheme to your application’s Info.plist:
Register the url scheme in your Info.plist. Lets say: my-great-app://
In the application delegate, implement this method and return YES:
When the user clicks a link like that, or you auto-redirect them from your site to that URL, you can parse the URL into an NSDictionary with this code. Here’s the method and an example implementation along with some pretty badass comments so you know what the heck is going on:
Let me know in the comments if you find this useful at all or if you make changes to it.
If you need a mobile app, call me. Please don’t be mad at me if I tell you that you don’t actually need one. At least, not in the way you think you do.
You may have heard that companies like Amazon and Wal-mart are getting some press with the release of their recent HTML5 mobile apps. Most agree that their decision is in efforts to avoid the App store vigorish.
What’s an HTML5 app? In simple terms (always preferred by this sales-guy-non-developer), it’s a web app that plays in your mobile browser, looks, feels, and acts like a native app, but you don’t have to go through any of the device stores to get it.
HTML5 App Pros:
Cuts the stores out, which can mean 30% take from Apple for example doesn’t apply.
Because it uses your device’s browser, it’ll work across any platform and devices.
One can essentially “hand” someone an app. I could have you scan a QR code, which takes you to the web app, and blamo you’re playing DinoPirates (the next Angry Birds, trust me.) almost instantly.*
You can still save the app to the home screen of your device like a native app, and cache data locally to the device, so it picks up where you left off last use. (Let’s say you were almost ready to overtake Volcano Island with your rag tag group of cast away Dinosaurs and you need to take a call from your boss for example…)
HTML5 App Cons:
There are some limitations to the HTML5 app, like it may not work with all the hardware features on the device like accelerometer, camera, gps, gypsy catcher, etc.
For some apps, the app store is important for exposure to drive users to the app, which won’t apply to HTML5 apps.
Not best solution for graphics heavy apps that need processing speed.
So, there’s a bit about HTML5 apps; it might be the right solution for the mobile application you need to make. Of course, there are other flavors of development and distribution between full native and full HTML5 apps. If you were lucky enough to attend our Mobile App A-Z Workshop last week, you likely saw myriad examples and best use cases for each option.
*On a side note, anyone want to fund this great idea I have for a game called DinoPirates? Battling extinction on the high seas—in pursuit of gold sound like something you may be interested in?
We love open source software here. Have a look at our GitHub profile if you don’t believe me. There’s absolutely no reason to re-invent the wheel when someone already built the spokes and rubber. We just put it together, modify some things and we’ve got the wheels ready to integrate into the car we’re building.
There’s been a lot of activity in open source projects for iOS development. There’s even places like CocoaControls.com that feature open source libraries and provide a central place to browse and talk about the libraries.
You may not need all of these libraries for your next project, but here’s some of my favorite libraries to use in iOS projects:
ASIHTTPRequest – This is the first on the list for a reason, and I would be remiss if this wasn’t at the top of the list. If you are still making CFNetwork requests you need to use this library. It handles every networking task you’d ever want including sending POST data, uploading files, server authentication, synchronous/asynchronous requests, queueing requests, caching, cookies, bandwidth throttling, and anything else you could think of. You can program using delegates or by specifying completion blocks. This is a must-have library for anyone writing iOS apps that use a network connection.
GCDiscreetNotificationView – This is a nice way to display information to the user without being as obtrusive as a modal window. Simple and elegant.
MBProgressHUD – For the times when you need to interrupt the user with information. This is great for download progress meters (using ASIHTTPRequest, of course) and synchronous tasks where the user isn’t allowed to interact with the application.
SSZipArchive – Based on ZipArchive, this class provides simple utility methods to unzip files with your iOS application. Great for downloading a set of files from your server and then unzipping them to a specific place in the filesystem. You don’t even have to init the class, it provides a singleton object that you can just call to unzip the file where you need it:https://gist.github.com/1216726
EGOTableViewPullRefresh – Ever wonder how you can do the cool “pull to refresh” thing like the Twitter iPhone app? This library makes it almost trivial to add that sort of functionality to your application.
DavidBoyes/SDWebImage – This is a fork from the main SDWebImageproject. This library is great for loading a network image into a UIImageView and retaining it indefinitely. The code uses a hash of the image’s URL to cache the image in the application’s /Library/ folder. If that same URL is requested by the application at a later date, it loads in the cached version instead of pulling the image over the network. This fantastic category addition to the UIImageView class will make your life a lot easier. Instead of using:
you can simply use
and the library handles everything FOR you (including placeholder images if you want). I forked that project and added some code that fades in the image instead of simply popping it in.
SBJson (aka json-framework) - I won’t get into the benefits of using JSONinstead ofXML in this post, but this is an overall great JSON framework. I’ve tried a few others, but this one takes the cake in terms of simplicity for simple parsing operations. All you have to do is init an instance of SBJsonParser, then you can get an NSDictionary by using:
Then don’t forget to release the alloc’d parser object from memory. Though don’t be fooled by the simplicity… there are tons of methods for reading, writing, and parsing JSON objects.
InAppSettingsKit – Apple has made a Settings.bundle format available to developers so that their app settings can show up in Apple’s own Settings app. But what if you want those settings to show up inside your app? Enter InAppSettingsKit. It gives you the ability to generate an almost pixel for pixel representation of the Apple Settings app. You can, of course subclass it like I did in one of my apps so that it matches the look and feel of your application.
ShareKit – This library is quickly becoming the de-facto standard for developers that want to give their users the ability to share things from within their application to social networks. Your users can share images, text, and even files (if the service supports it). All the big services are supported like Twitter, Facebook, Instapaper, Tumblr, and more… but the great thing is that since it’s completely open source, any developer can write a plugin for any service and utilize the ShareKit framework’s underlying code.
Flurry – (non-open source) This one isn’t so much a library but a great service that provides a library for you to use. Flurry is a developer’s best friend when it comes to tracking application usage (anonymously, of course) and statistics. You can set up triggers and events to see what users are interacting with certain portions of your application. One great thing that Flurry does is intercept uncaught application exceptions (i.e. “crashes”) and tells you what type of device it was on as well as the crash message, though the crash logs aren’t as comprehensive as something more complex like CrashKit.
I hope you’ve enjoyed this list of libraries. I have used every one of these in an iOS application at some point and they’ve saved me innumerable hours of coding so giving back to the community in the form of code or publicity wherever possible is a must.
Do you have a favorite iOS library you use all the time? Let us know in the comments!