from: iphone -> ipad; a quick guide.

it’s time to expand your iphone app and introduce it on the ipad. that is an interesting move for any product as the ipad is not an iphone – it is used for different things at different circumstances. yeah – you are going to practically re-think your app… which is great because you get to revisit your code and make sure your pipeline is tight, secure, fast and reliable. all that with the elegance of the ipads – split view controllers

where do one starts? well, you can start be designing your app for the ipad and take by thinking about the following:
orientation, layout and gestures. all of which vary significantly from the iphone (unfortunately). side note: one thing i really like about webOS is that you develop your mobile app once and the system takes care of adjusting the interface to a slated device.

next thing to learn about the ipad is it’s split views, popovers and specific hardware features – all of which are ipad unique. you will need to use conditional coding to learn if a specific hardware feature you are looking for is available. this is necessary as you will need to load the right resources to handle that hardware. more specifically one should write conditional coding for:

resources: in your code, recognize which platform is running and load the right nib files. you will also need to load the right graphics that match the screen size and resolution.
classes: check for class availability based on the device you are running on as some are iPad/iPhone specific.
methods: weak-link any device specific methods and perform a check at runtime for the availability of that method and wether the object responds to a specific selector.

hardware: test for cmarea/gps/gyro support before utilizing it.

okay – we are done with the overview. let’s roll up our sleeves and dig right into it.

first thing’s first – lets let xcode help us start the process by duplicating the current target (an iphone target) into an ipad one.
right click on your target and choose “duplicate”. two options here – duplicate only and duplicate and transitoin to ipad. let’s go with the later.
what xcode does here is create a new virtual folder (i.e. group) called “Resources-iPad” and copies the main nib file there. xcode really takes care of the main nib file and creates it for us. no other nib files to be touched. why? because the rest of the nib files are usually tied right into apps view controller so xcode leaves it up to us to define both the view and it’s controller. xcode sets the targeted device family (TDF) build settings to iphone/ipad and modify the base SDK of the project which will support both device types. no need to touch nor worry about the deployment target. you will see a new plist for the ipad app with it’s relevant settings.

in order to see it in action – run the app using the ipad simulator. what you will see is the iphone app running inside the ipad simulator and you can x2 time it to fit. boooo. one more step necessary (thanks apple for leaving it up to us) is to update the scheme to use the new and shiny ipad target. so go ahead and duplicate your iphone scheme (or create a new one) and under run  – choose the ipad executable. boom. wait – it really looks bad here.

well – as you may know iOS uses the MVC design pattern heavily. you may not know that MVC is actually a compound design pattern which includes 5 patterns. luckily this abstraction makes the process of porting an iphone app to an ipad a bit easier, as potentially one needs to take care of the view – making sure the right outlets are updated based on the design of the UI, and also heavily touch upon the controller to see which device is used and then follow a specific code path to match. the good news is the model can stay untouched 🙂

if you are happy with the IBOutlet you currently have on the iphone and would like to only use those (i cannot image why, but yeah…) all you need to do at this point is adjust the springs and struts in the size inspector when loading up your nib in IB. you should also make sure to support the orientations required for the app. in order to do this you will need to  implement shouldAutorotateToInterfaceOrientation:  and test for the device running the code and allow rotation. if you have singleton object place this code in it’s header file:

#define IS_IPAD   (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
#define IS_IPHONE (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone)

ipod touch returns UIUserInterfaceIdiomPhone. FYI.

or place it wherever works for you, as long as you have access to this macro from wherever. this is useful as you will need to update your controllers to test for the hardware running and follow a specific code path to update your view and outlets.

one example of using this code and auto rotating is this:

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {

	 if (IS_IPHONE)
	 {
		 if (interfaceOrientation == UIInterfaceOrientationPortrait ||
			 interfaceOrientation == UIInterfaceOrientationPortraitUpsideDown)
		 {
			 return YES;
		 }
	 }

	 if (IS_IPAD)
	 {
		 if (interfaceOrientation == UIInterfaceOrientationLandscapeLeft ||
			 interfaceOrientation == UIInterfaceOrientationLandscapeRight)
		 {
			 return YES;
		 }
	 }

	 return NO;
 }

pretty easy and straight forward right? moving along.

cautionary tale:
the app now must be careful with the symbols it uses. if you want to use UISplitViewController while running on iOS 3.1 – your app will crash as there are no split VCs on 3.1.
the way you should be thinking about this is by mentally tuning into the ‘runtime checks’ zone, where you will test if a particular symbol exists. more about that later.

updating VC and views:
this is where the bulk of the work really is – redoing your views and adding code (or creating new) view controllers. what can we do – the view size varies between the iphone and the ipad and that certainly needs to be taken into consideration. so start off by redesigning the views for the ipad. if you plan on scaling the existing view could work okay, but more often than not will not be the result you are hoping for. think of it this way – the new ipad interface should make use of the new available space and the elements which only exist on the ipad (splitVCs and popovers for example). the outcome is good UI and top UX.

also consider the following. for view controllers:
a) create new nib files for each device (if you use nib files that is).
b) if you code your views – make sure you support both devices when you do so.

for views:
a) if you override drawrect: make sure the method can draw to different view sizes.
b) if you implemenet the layoutSubviews method, the code must adapt to different view sizes.

symbol checking during runtime:   if deep down inside you had hoped that this step will somehow be avoidable – fear not 🙂 runtime checks for newer symbols is easy as pie and is the type of topic you can discuss with your boss and sound really clever.
all of this is under the assumption you support different versions of the OS. just like a good soldier – you MUST protect your code from using symbols that do not exist. this happens all the time when you update an app to use new features and want to continue to support previous versions running on older OSs. all you need to do is create different code paths to follow, based on the OS currently running on the device executing your app. if you don’t do that your app is guaranteed to crash and that is not something us pros do, so let us quickly look into an example of how one goes about creating a code path when checking for newer symbols during runtime:

if you are linking against iOS 4.2 you are in luck my friend. that version has a weak linking support built right in, which allows you to check for the existence of a given class object and determine if it’s usable to you. like so:

if ([UIPrintInteractionController class]) {
   // Create an instance of the class and use it.
}
else {
   // The print interaction controller is not available.
}

seriously now – how simple was that?
bare in mind that if you want to use this feature of the OS you must build your app with LLVM and Clang.
deployment target should be 3.1 or later. sorry.

if your app links against < 4.1, use NSClassFromString to see if a class is defined. if nil is returned – you’re shit out of luck.

for example:

Class splitVCClass = NSClassFromString(@"UISplitViewController");
if (splitVCClass)
{
   UISplitViewController* mySplitViewController = [[splitVCClass alloc] init];
   // Configure the split view controller.
}

for testing if an object  can be sent a specific message (i.e. has implemented that method), use the oh so convenient instancesRespondsToSelector: class method (yes, it is a class method, it’s not a type).

if you are a registered iphone developer and have not done so – check out the SDK compatibility guide by apple.


runtime checks –> conditional code paths:
based on the interface idiom described earlier – let’s start creating cool code paths to support both devices. a simple if-else statement will do just fine thank you very much. moving right along.

This concludes this first steps required to port your app from iphone to an ipad. next is a quick rundown on how to use split view controllers in your ipad app.
 

what i’d like to see in the iphone5 (and probably won’t)

Good chance of getting:

4G LTE: 100Mbit up, 50Mbit down (peak). this will be huge for everyone. streaming made easy, uploading live videos and pretty much change the rules of the game when it comes to utilizing the phone. the big question is – can the carrier(s) handle the demand?

HD front and 8MP rear camera with a dual flash system. HD facetime – thank you very much. better photos at low light condition? yes please. no doubt apple will introduce major improvements to the camera, both hardare and software. by now the iphone is the most popular camera on flickr and it’s growing fast. we want to be able to take better photos easily, at different conditions and share them quickly. as the pixel count rises so the demand for bandwidth (see 4G LTE) and a quick turn around for large file sharing. we can ex (cpect something unique with this feature’s new offering. the inherit problem is the small chip for the camera and it’s ability to shoot in lower light conditions.

wider screen: has been rumored for a while with some fake prototypes etc. can’t wrap my head around a wider screen unless it’s up to full HD, which will be, no doubt, incredible (i’ll rate this as 1% chance of happening). if i’ll have to guess it will be retina 2.0 with a slightly higher pixel density and a more crisp display than the current 960 x 640 at 326 ppi.

better battery life: with iCloud and push across the board, there is no doubt apple is pouring tremendous effort behind making their devices stay up and running longer. expect something unexpected.

built in noise cancelation mic: a la jawbone, it’s time for the iphone to become a better phone. and please let’s take care of the proximity sensor issue. please.

NFC with eWallet OR BLE (4.0) + APIs: this will be very exciting to have. finally. eWallet patents are around for a while and android is a head of the curb. if we look east to japan we see clearly how mobile is used and credit cards are gone. yes – gone. the phone will be THE payment system in the very near future. it’s the credit companies that should be on their toes with this one. it is really all a matter of timing no? can’t enter too soon and definitely not too late.

there has been much discussion over Bluetooth Low Energy, otherwise known as BLE, which is the 4th version of bluetooth, now available in the just released macbook airs. what the new standard means is low energy consumption and wider range (50m) which means awesome apps and peripheral devices are heading our way. this is an interesting strategic call by apple, do they go with NFC and RFID or do they bet on BLE? based on the this recent move of incorporating BLE chips within the new line of macbook air… well… let’s see what happens 🙂

Little chance of getting:
solar charging: apple has been working on this for a while now. heck, there is a prototype out in the wild that is solar enabled (link). this is a game changer and the reason why there’s little chance of getting this one is because it’s probably required to perform much more tests and phase out gradually. maybe a device which combines both battery and solar charging a la hybrid first.

haptic display + APIs: probably the advancement i would like to experience the most. haptic displays will revolutionize the way we interact with smart devices and their touch screen as they provide feedback to our touch sensory system. imagine that each button you click on a touch screen feels real. this is huge for UX across the board and opens the doors for some unique applications. android has immersion – a great company to follow with a great mix of products, worth mentioning are their medical related haptic devices. check it out here.

new map application: apple has made significant moves to become a player and tighten their vertical integration. this app should be nothing but fantastic and introduce features never seen before on smart devices. one option could be an augmented reality turn by turn navigation, integrated with location meta data and the users social graph.

iOS 5 is around the corner (updated)

iOS 5 image

update: this post was written thursday of last week. it is now semi confirmed the developer of mobileNotifier is hired by apple and that iCloud will be presented by jobs tomorrow.

one major revamp is the bare minimum as there are areas lacking where either android or cydia leaves the current OS lagging. and no doubt we will get what we are expecting.. just a gut feeling… here is my short list of enhancements that i’d like to see:

1. improved notification system: bar non that most important and required change to iOS. face it, the current notification system sucks big time. in the past, the real incentive to jailbreak your phone was mywi, my3g and going even further back, multitasking and naturally the most important feature – sim freeing your phone (Screw you apple and ATT for violating FCC regulations). now-a-days, mobileNotifier is THE reason why my phone is jailbroken. aggregate all notifications into a single window utilizing the empty space created when you double click the home page. apple – pls take note, this guy has done a great job.

2. dynamic home icons: ala windows8. yes you heard right. big chunky icons that actually display content and not just a static image. one good example is available on cydia and is called ‘weather icon’. it changes the degrees on the weather icon to display the current temperature. it also allows the temperature to be displayed on the status bar. really useful stuff. apple, please expose an API to do so.

3. OTA updates: not likely but definitely nice to have… over the air updates makes lots of sense. please – no more plugging in to itunes and backing it all up. this ties up to the next item that is most definitely making an appearance on monday:

4. iCloud content sync: this will probably make a big eco. iCloud can and will take cloud services to the next level. apple doing what they do tiered up, may see music sync and later down the road app sync.. so iCloud will probably allow you to purchase music from iTunes and stream it directly from your cloud storage. no need (or an option) to download and sync stuff. fantastic. one viable option is to open a US front against spotify, the EU-stream-the-song-you-want kind of service in the US. imagine a yearly/monthly plan ($20-$50/year) where you can listen to what you want… that’s a nice one.

WHAT’S MISSING? iphone5 with 4G, NFC and iWallet, A5, double down on RAM, larger display and IR.

Pure West for iPhone and iPod touch on the iTunes App Store

My first iOS app is live on the app store. It is an iPhone compatible schedule for Pure Yoga West, one of the top yoga centers in NYC in the upper west side. The app is free for download from the AppStore.

This project started off when I joined Pure West as a member. Yoga became a big part of my life as I practice on daily basis. Since Pure West offers around 27 different kinds of yoga between 5 studios, starting as early as 6am – you can imagine the teachers they have as staff and the frequency they update the schedule.

Something was broken. The paper schedule provided at the front desk was out of date as soon as it was printed. Could be a minor change to a single class, to time of full moon where ashtanga is not practices (which can not be reflected in a single week sheet), to the twice a month led practice of mysore.

Pure uses spa-booker as their service provider, doing all the heavy lifting with proprietary database system and interfaces to both manage the content and display it to the public. it gets more complicated than that as some classes are special and specific where members (or non members) need to pay and more.

Since spa-booker is working on their own version for the mobile devices, and I knew I am in need of a solution for myself that can probably serve others – I jumped on the challenge to create something.

Working closely with two friends, Tomer and Claudio, together we build this app that does the following well:

– single click to get class schedule and class info
– fast loading of the data
– layout that matches the small iphone screen

Essentially we build a system that scrapes the HTML of the entire week. Then we parse the content diligently and store it in our XML proprietary format. The interface picks up the XML whenever someone launches the application and displays it on screen accordingly.

For performance reasons we are re-visiting Pure’s website every two hours to see what had changed, parse the content and re-write the XML. On the client side only one day is loaded from the server. When a user changes a day, we go back to the XML and look for the content of that day exclusively.

The app is a UIWebView essentially, as the app is developed as a web application. The release to the AppStore will help the discovery, but also for us to learn the process and time line for doing so, as we plan to move forward with other developments of our ideas and our client’s.

The beauty of iOS apps is that they strive to keep things simple. When you launch the application, it is really hard to judge how much work was put into it, and how much lifting is done in the background. Things just work as they should, both in layout, style and user experience, including performance specifically.

One of the advantages of designing this app abstractly, is that now we can custom create it for any spa-booker customer within the day.

We are in touch with Spa Booker who are supporting our efforts. Future plans may include using their API’s to book classes directly from the phone, add more specific information to classes, like which element of zenyasa is being practices today, and provide a delta of changes since a user last visited the schedule.

The Pure East application (the 2nd location for Pure on the upper east side) is pending approval by Apple. Based on the approval of Pure West, it is a matter of days before that one will be approved as well.

the next stage for smart phones

no doubt apple revolutionized the smart phones industry. apple gave the market a real shuffle when it introduced it 3 years ago. it was the user experience that made the difference – just like any apple product – from their software to their stores: it’s all about the user experience.

what helped the iphone take off was the community of developers. believe it or not, it is the early hackers who put their time and wits into action, to jailbreak it. jailbreaking means you free the phone from the exclusivity of the appStore, and are able to install apps from other developers (for free or for $$). there are several alternative appStores out there, like cydia and ‘rock your phone’.

why would anyone be interested in installing apps that are not on the appStore? mostly because they extend the capabilities of the device beyond what apple allows or is planning for the time being. for example: tethering. how long did we hear from ATT that tethering is arriving? why can’t we share our internet connection with our laptop and have the iphone serve as a hub? ATT is planning to do so (they claim they are making way for the bandwidth load they are experiencing altogether) for an extra (yes, u heard it right) extra $30 a month. so you pay $30 on your iphone to be constantly online with an unlimited bandwidth (it actually is capped if u check your account page online), and you will pay $30 more to tether.

if you jailbreak your iphone you can install an app called myWi which allows you to tether for a small one time fee of $20. sounds like a good deal right? it is.

another good example is using your data plan as you wish. the internet neutrality act proposes that each and every one of us can use his/hers connection as they please without the internet provider throttling and/or blocking the connections (which happens in spades, though most providers do not admit this). in fact, chile is the first country in the world to anchor network neutrality within it’s constitutional right.

currently ATT does not allow skype calls to be made over the data plan. only wifi. the same goes for ‘face time’ with iphone 4. you can see the other side only if both are over wifi. that pretty much sucks doesn’t it? well, ATT has been putting billions of dollars into infrastructure and i can attest that their signal has gotten better (not much but better) here in NYC. however, i cannot understand what reasons they had (besides greed) to up the data plan cost from $20 on iphone g1 to $30 for the exact same package.

back to business. if you install my3g you can fool the phone into reporting it is over wifi while you are actually over the data network.

want more examples? they are a plenty: sbsettings (allows you to control the phone via a swipe jesture, turn on the phone, the data connection, blue tooth, kill processes and more) proswitcher: allows you to multitaks, meaning putting an app in the background (now partly available in os4) ultrasnow: allows you to unlock the phone, so you can use it with other GSM carriers in the US or over seas (something ATT must provide you by law when traveling abroad – which they don’t). and many many more.

so now back to the title – the next stage of smart phones. well, the title is misleading. it should really read the next stage of smart devices. and that is exactly what they should be: smart devices.

the revolution had already started with the micro sim cards for the ipads. take a device and connect it to the internet – you are golden. forget about minutes, rollovers – all we really have is our data connection. do you want to make a call? launch skype. you can make unlimited calls in the US for $3 a month. face it – a phone is just an application, just like your painting tool or recording device. whatever you want to do will be %100 over the network without extra fees or hidden charges.

and they are all afraid of it because they will loose tons of money right? all the fees on our bill, state charged nickel and dimes for F charge and G cost. the interent scares that scavengers because what will you charge on top of the data plan?

and that is all i really want and the next phone i will get: a device that has the ability to connect to the internet without a phone attached to you. an ipod touch with a micro sim card will do fantastic for me and i will gladly give up my iphone for it.

the future is all about our freedom and ability to connect. it is all about us spending much less (think annually) and getting much much more bang for our buck.