Hi everyone thanks for coming, its great to be back at ArcSig. Normally I present on .NETtopics, but this last year has be...
So before we start writing a single line of code we have some big choices to make. Nonebigger than what style of applicati...
process? What happens if the app is rejected for some reason? Is this going to impact the  business somehow?• Does your QA...
The first thing you need to get started with iOS development is a Mac with OS X. You mustuse Apple hardware to legally cre...
that will run on Snow Leopard, I am not sure if those versions are also free or not. Thereused to be a $5 charge for Xcode...
iOS apps are typically written in Objective-C. Objective-C extends C with some additionalkeywords that open up an object o...
The analogy with C+ was useful to me in the early stages of learning the language; butObjective-C is a very different lang...
Blocks are a C-level feature added by Apple. They are closures and they were introduced tofacilitate Grand Central Dispatc...
Cocoa Touch is the MVC-based UI framework on top of which you build iOS applications.Most iPhone UIs are built around the ...
HBO’s app.., those apps are very creative and really exploit the iPad to its fullest. Those arebig budget apps however and...
Ok so I am going to demo for you guys a proof of concept application that I worked on lastyear. This app was designed to r...
time there were not that many choices but I noticed there a some more native gridsavailable now. There is a project called...
Ok this where things start to get pear shaped. Deploying native applications is fairlycomplex, and this where Apple really...
Distribution profiles do not include device IDs, and are for production builds that you intendto send to the App Store. Th...
9
So there are probably many more                                  10
## THROW AWAYDevelopment allows you debug locally, distribution is basically for everything else. Certs getassocaited with...
So obviously one the first things that comes to mind when we talk about the differencesbetween a native app and a HTML 5 a...
Upcoming SlideShare
Loading in …5
×

Enterprise ipad Development with notes

613 views

Published on

Keith Tingle's presentation notes from March's Meeting

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
613
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
2
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Enterprise ipad Development with notes

  1. 1. Hi everyone thanks for coming, its great to be back at ArcSig. Normally I present on .NETtopics, but this last year has been unusual year for me.. I got involved with severalenterprise and B2B iPad projects. There are some challenges, some pitfalls associated withiPad development and if any of you find yourself working on or around an iPad project myhope would be that this talk helps you avoid some of those pitfalls.Apple has targeted the consumer and education markets with the iPad, I don’t think thereis any question about that; but what about businesses? Can businesses repurpose the iPadas a tool to do real work? I think so. Do people just want to bring their favorite toy towork? I believe that also. I have encountered some customers who simply had to have aniPad app. Some business people feel that there is some sort of technology phenomenagoing on and they are compelled to participate. They charge down the path of creating aniPad application for their business thinking that it’s going to be a relatively small or simpleproject. After all the device is small and its simple to use, so its somehow intuitive thatcreating software for it is easy. The truth of course is that its no simpler to create softwarefor the iPad than it is for the web or the desktop. In fact depending on your projectrequirements you may find the platform to be *more* challenging to develop for thansome of the conventional platforms like .NET and Java.As architects and developers our goal is make our customer’s vision come to reality;whether Apple targets business users or not. We have an obligation to make it work. 1
  2. 2. So before we start writing a single line of code we have some big choices to make. Nonebigger than what style of application to write.You have two choices, a native iOS application or an HTML 5 web application. Sometimesthe requirements make this choice for you, sometimes your customer is adamant abouttheir choice and your path is set.My hope is that business people will always consult the technical experts to help makethese kinds of important choices. We need to make sure on our end that we understandthe options fully and that we lay them out clearly before the project gets started.I have put together some key questions that I think help choose the correct path for a givenproject.• I have encountered some apps that are functional clones of web sites. The app offers more or less the same user experience as the web site.• Are your users employees of the same company where you work? or are you in a B2B situation where you are creating tools for your customers to do business? This is a crucial question… and we will talk about why its so important when we talk about deploying native iOS applications.• Can your users wait a week for a fix to be pushed through the App Store approval 2
  3. 3. process? What happens if the app is rejected for some reason? Is this going to impact the business somehow?• Does your QA team use automated tools to test your software? Do they have processes already in place for testing web applications? If QA is an afterthought in the planning stages of the project is going then its probably going to become a critical issue towards the end of the project where QA is most active. 2
  4. 4. The first thing you need to get started with iOS development is a Mac with OS X. You mustuse Apple hardware to legally create iOS software.Normally if we need to develop software in a environment that is not a conventionaldesktop environment.., our IT folks will ask us to use virtualization. So historically Apple hasrestricted virtualization of the client version of OS X. The story got a little bit better withthe release of Lion, the most recent version of OS X. You can legally run two virtualinstances of Lion locally using a virtualization product like VMware Fusion, but you are stilllimited to Apple hardware. You are not going to be able to install VMware workstation forWindows and install a copy of Lion as a guest O/S.I have seen a lot of terminal server solutions on the web for delivering OS X desktops tousers but I have no experience with those solutions so I cannot really vouch for theireffectiveness for development purposes. I assume your developers would be able to testtheir code on the iOS simulator in a terminal, but in order to debug on a real iPad theywould need an Apple computer with a USB port to plug the device into. Testers do *not*need Macs, but of course they need an iPad to download the software and test it.For most companies I don’t think it’s a huge issue to get everyone on the team a Mac, it’s agood morale booster certainly but its something you need to plan for and budget for.Xcode is the Apple supported IDE for iOS and OS X development. It’s a free download fromthe Mac App Store but it does require Lion. I think there are older versions also available 3
  5. 5. that will run on Snow Leopard, I am not sure if those versions are also free or not. Thereused to be a $5 charge for Xcode on the App Store.If you intend to run your apps on real devices you must enroll in the iOS Developer Program.This gives you access to some developer forums and other resources but the real reason youjoin is you get access to the provisioning portal. The provisioning portal allows you to requestdevelopment & distribution certificates, reserve App IDs, and create provisioning profiles.You also get access to iTunes Connect which is the developer gateway for uploading apps tothe App Store.The iOS Developer Enterprise Program (a.k.a. IDEP) allows you to build in house enterpriseapps and deploy those apps outside of the App Store. We will cover this in depth later. 3
  6. 6. iOS apps are typically written in Objective-C. Objective-C extends C with some additionalkeywords that open up an object oriented style of programming. Xcode also supportsObjective-C++ which is a Frankenstein language that tolerates Objective-C and C++constructs in the same application. There are many restrictions.., for instance you cannotderive one type in one language in the other language. Objective-C++ is useful for multi-platform programming, for instance if you wanted to share a library between iOS andAndroid, you could compile the same code with both Xcode and the Android NDK. I am notsure what the C++ support is like in WinRT but I assume its possible to compile ANSII thereas well. That’s pretty compelling that you could share core logic between three mobileplatforms with a shared C codebase. I am currently working on a project where we smoothstream Microsoft PlayReady DRM protected content to an iOS player. << Explain MicrosoftPlayReady client licensing w/ regard to ANSII C>>You create type definitions in Objective-C in a dot h header file like C++. Objective Cimplementation files are given a DOT-M file extension, and Objective-C++ implementationfiles have a DOT-MM extension. 4
  7. 7. The analogy with C+ was useful to me in the early stages of learning the language; butObjective-C is a very different language that just shares some heritage w/ C++. One largedifference is that all method calls in Objective-C are dynamic. You can send any message toany object, the compiler will emit a warning if the receiving type doesn’t declare supportfor that message.., but it won’t break the build. Every message is represented by thecompiler as a selector, all instance methods are ultimately passed the self and parameterand a selector parameter that identifies the message that was sent to the object. Thecompiler supports a specific syntax for selectors.I am sure this is a powerful feature of the language but it seems underutilized to me. I havenot encountered developers using the dynamic features of Objective-C as often as I haveseen them used in JavaScript or Ruby.There is a garbage collector available for OS X applications, but not for iOS. I think iOS is theonly mobile platform (maybe Symbain?) that doesn’t have a garbage collector. iOS 5introduced Automatic Reference Counting or ARC. Its eases the load of low level memorymanagement for developers but it is not a fully fledged garbage collector. It’s a buildsetting.., and it requires the developer to stop managing memory in their code anddelegate that responsibility to the compiler. The compiler with emit errors if the developerattempts to manage memory manually. So it’s really an all or nothing proposition. If youhave legacy iOS code you have to do more than just compile with ARC enabled, you have toremove the memory management portions of your code base. Xcode ships with arefactoring tool that will assist with this conversion. 5
  8. 8. Blocks are a C-level feature added by Apple. They are closures and they were introduced tofacilitate Grand Central Dispatch which is Apples task-based parallelization framework. Someof the core APIs have started to add messages that take blocks as callbacks.Exceptions play a different role in Objective-C compared to other common languages like C#and Java. Errors like a network address not being available or a file not being where itsexpected to be do not throw exceptions, you typically get a nil response from the object inconjunction with it populating an NSError object with information on what happened. 5
  9. 9. Cocoa Touch is the MVC-based UI framework on top of which you build iOS applications.Most iPhone UIs are built around the UITableView control, its list control on steroids without-of-the box support for section headers, images, and navigation. Most apps customizethe UITableView heavily to achieve a certain look and feel. It’s a list control though and itdoesn’t really support the concept of columns, everything is a row. You can make aUITableView look like grid with columns but column operations like sorting are going to besupported by hand.When I first started developing for the iPad I was surprised by the lack of controls. Up untilthe iPad release.., Cocoa Touch was all about the iPhone. Well the iPhone is used in adifferent way than the iPad. You rarely see people using an iPad while walking or driving.Users hold them differently, they interact with the devices in different ways.An iPhone user is after some sort of information and is probably doing something else inparallel, and the Cocoa Touch control set was designed for that user.I think an iPad user is probably going to be in a more relaxed state. I think they may be in amore exploratory mood, and more willing to negotiate a complex UI. Well that wouldprobably call for some additional controls right? Cocoa Touch added theSplitViewController which is great for displaying parent-child relationships. The Popovercontrol which is a popup overlay window is also widely used. But that’s it.I think the lack of controls has spawned a lot of creativity, if you look at Twitter’s app or 6
  10. 10. HBO’s app.., those apps are very creative and really exploit the iPad to its fullest. Those arebig budget apps however and writing focused, custom controls for those apps makes sense.Enterprise & B2B applications normally have more screens and justifying custom controldevelopment is tougher. 6
  11. 11. Ok so I am going to demo for you guys a proof of concept application that I worked on lastyear. This app was designed to replace a desktop FoxPro application used by clothing salesreps in the field. This was a large leap forward obviously in technology from FoxPro to iPad.The choices we made in developing this app were I think very conventional, we drovedown the middle of the road. For data we used SQLite 3 which comes supported out thebox with iOS. The default interface to SQLite is straight C.., which can get tiresomeallocating and de-allocating buffers for all of the bound data. Early on in the project wediscovered fmdb, which is a very thin Objective-C wrapper over SQLite. This library helpeda great deal and gave data access more of an ADO.NET or JDBC feel.The service layer was very simple. We deployed a RESTful service that generates a SQLitedatabase file based on the identity of the authenticated user. Rather than waiting for aunauthorized response from the server and making an additional round-trip we providedthe user’s credentials preemptively by base64 encoding the user name and the passwordand adding it to the HTTP header. Obviously you are relying on the SSL transport to securethe request. The users credentials are stored in the sandboxed iOS keychain. Access to thekeychain is made through a dictionary style interface which I found to be a little difficult towork with. The keychain is one the big advantages of native apps however in that the userdoesn’t have to supply a password when starting the app. Depending on your securityrequirements that may have a big influence on your choice.For the grid control we choose AQGrid which is an open source project on GitHub. At the 7
  12. 12. time there were not that many choices but I noticed there a some more native gridsavailable now. There is a project called GridMonster on GitHub that attempts to demo all thesalient features of the different grids that are avaialble in one app. It might be wise to getthat project building and running before making any choices or rolling your own. 7
  13. 13. Ok this where things start to get pear shaped. Deploying native applications is fairlycomplex, and this where Apple really starts to get in our way when trying to buildenterprise applications for the iPad.At the root of this deployment system are code signing certificates; there are two kinds..,development & distribution and Apple must issue them to you. They expire every year andonce they expire your apps are pulled off the App Store and will no longer run on a device. Iactually see this is as a good thing in that there are some 500,000 apps on the App Storeand if an App is not being maintained, if its not being purchased.. then its probably OK forthat app to be pulled and unclutter the App Store some. When the current excitementcools down I would expect the App Store to start contracting.., but I am no holding mybreath.Provisioning profiles combine certificates with an optional App ID and possibly device IDs.An App ID is a reverse domain name style identifier that is used by iCloud and thenotification system to distinguish your apps from all the others. Device IDs are uniqueidentifiers assigned to devices at the factory. As a developer you are allowed to associate100 devices total to you account. Only development and Ad Hoc profiles require device IDs.Ad Hoc profiles are intended to be used for testing. You have an app you would like to getsome feedback on or do demos then Ad Hoc profiles are the right choice. There are someservices out there that can help you deliver Ad Hoc builds to users from a singledistribution point, the most popular being TestFlight @ http://testflightapp.com. <<Explainhow TF works>> 8
  14. 14. Distribution profiles do not include device IDs, and are for production builds that you intendto send to the App Store. The profile ties the code signing certificate to an If you are an IDEPmember your distribution profile allows you deploy your app outside of the App Store. Youcan build your app, sign it and throw it up on a web server and your users can install itdirectly to their device. Sounds perfect right? Well there are some restrictions… you mayonly distribute your app to internal employees in your organization. This deployment style isfor in house applications only. Obviously Apple is protecting the App Store by doing this. Theydo not want people selling their apps outside of the App Store and avoiding the 30% sharethat Apple takes from each purchase.I have always told customers that something has to change with the IDEP. Its just toorestrictive particularly for B2B scenarios. When I started preparing for this talk I discoveredthat Apple created a brand new deployment style called B2B. This deployment style goesthrough the App Store. *If* your customer is enrolled in the Volume Purchase Program yourapplication will become visible to them and they can purchase it. Your app must cost aminimum of $9.99. I am not sure if this is the answer or not, but its an improvement. I thinka lot of company-issued devices company devices are configured for company email but theindividual logins with their iTunes account to buy music and games and so forth. 8
  15. 15. 9
  16. 16. So there are probably many more 10
  17. 17. ## THROW AWAYDevelopment allows you debug locally, distribution is basically for everything else. Certs getassocaited with provisioning profiles in the provisioning portal##In the past there where four basic choices for deployments. Development is simply adeveloper debugging a build on a device that is connected to their Mac via USB. Eventhough that seems like a harmless scenario Apple still requires that the application besigned by a development certificate before it works on a device. Xcode does a really goodjob of syncing the OS X keychain with the provisioning portal and setting up the profiles onthe connected device automatically. You never would notice that code signing is going on ifyou were not paying attention to it.On other mobile platforms like Android for instance you can email your testers an app andthey can install it on their devices with very little trouble. 11
  18. 18. So obviously one the first things that comes to mind when we talk about the differencesbetween a native app and a HTML 5 app is connectivity. Is it possible to have create anHTML 5 application that the user can launch from the iPad’s springboard and view pages.HTML 5 documents can utilize an cache manifest file to instruct the mobile safari to holdfiles in the application cache.The document that contains the manifest tag is added to the app cache implicitly, but it canalso explicitly reference dependencies like JavaScript files and have those cached as well.The app cache file itself has a simple syntax.The application cache in HTML 5 is always working. If you added a file to the applicationcache that file will be served from cache whether or not the browser is offline. 12

×