Upload
truongtram
View
224
Download
4
Embed Size (px)
Citation preview
Ge>ng Started
• Minimal Prerequisites – Hardware
• Touch Device ( iPhone/iPod ) ($300‐$500) – Either device will work fine, you’ll need access to both for tes+ng – You don’t need real touch hardware to start development, you can use the simulator to get going
• Intel Mac (mini/MB/MP) ($499 ‐ $5000+) – No, you don’t need a dual 32” Cinema display Mac Pro with 8 Cores and 32G of ram. Take that $12k and pay for a few more semesters of school
– A Macbook (white model) is more than sufficient and frequently seen around campus and a mini is perfectly adequate.
– Latest models aren’t required, get a refurb from the Apple Store or find a used Intel model on craigslist and save some money
5/1/09 2 [email protected]
Ge>ng Started
• Minimal Prerequisites – Soaware
• iPhone SDK (Free) – 2.2.1 Latest prod, 3.0 in Beta – Includes:
» Xcode » Interface Builder » iPhone Simulator
• OSX 10.5
5/1/09 3 [email protected]
Ge>ng Started
• Minimal Prerequisites – Licenses
• Apple Developer Keys – This takes a up to week or two and costs $99/yr for a personal license,
$300/yr for a corporate license • Developer is granted a key for a generated iden+ty and creates a profile
• Developer registers devices with apple as development devices • Devices are added to the profile and cer+ficates are downloaded from Apple
• Profile is added to Xcode and then installed into device • User created app can then be installed • Step by step guide found on developer.apple.com, accessible aaer you’ve enrolled and paid for your keys
5/1/09 4 [email protected]
Ge>ng Started • iPhone v Simulator
– Performance • Network • Graphics • Disk I/O • It’s a soaware simulator, not a
hardware emulator – Filesystem Access different
• iPhone allows write to only Documents directory
• Simulator allows writes to app bundle directory
– Touch func+onality • Simulator adequate for basic
touch/swipe – No access to accelerometers
(no shake/+lt) – Orienta+on change menu
driven process
5/1/09 [email protected] 5
Ge>ng Started
• iPhone v iPod Touch – Base system func+onality
• iPod lacks phone • iPod lacks microphone
• iPod lacks a camera • iPod touch has a larger drive • iPod touch has lower cost point
5/1/09 6 [email protected]
iPhone v Mac Development
• Mac is a standard Unix machine – Plenty of memory, disk, swap,etc
• iPhone is severely resource constrained – Memory management cri+cal
• Host swaps when out of memory, iPhone crashes
– iPhone is a sandboxed environment • Filesystems on iPhone severely restricted • Apps cannot interact with anything else outside of its app bundle
• Interac+on with Hardware done exclusively through API calls.
5/1/09 7 [email protected]
Xcode
• The Standard Apple IDE • Integrated Debugger, Doc Browser, Class Browser, standard Color Highligh+ng, etc.
• Text auto comple+on – Incredibly Useful
• Mul+language – ObjC / ObjC++ / C / C++ / Java / Cocoa / Applescript
• Really needs vi bindings… ;) 5/1/09 8 [email protected]
Interface Builder
• The standard Apple tool for developing UIs. • Same tool for use with na+ve OSX applica+ons as well as iPhone Apps – Experience directly useful between plaporms
• Drag and Drop UI Design • Applica+on look/feel limited to the UIKit library – User images can be used for most buqons/icons/etc to try and alleviate generic look
5/1/09 11 [email protected]
Development Languages
• Objec+ve C – Older Language, 1980s – C was extended with SmallTalk support and was retrofiqed to support OOP
– Popularized by NeXT – Primarily used today for Mac OSX and iPhone programming
– Support can be built into GCC – NSFoo prefix throughout the code is a reference to NeXTStep
5/1/09 14 [email protected]
Development Languages
• Cocoa – A collec+on of APIs wriqen in ObjC referred to as the Frameworks • Founda+on Kit – provides core func+onality. Ie, String type, iterators, data storage, almost anything with an NSFoo prefix (NSString, NSData, NSDate)
• Applica+on Kit – provides all graphics func+onality for applica+ons
– Also derived from NeXT – Interac+on with Framework is typically in ObjC using Xcode and Interface Builder
5/1/09 15 [email protected]
Objec+ve C
• Method Comparisons – Compare the C++
• (void) someClass::doSomething(int foo, int bar); • Called as myClass.doSomething(1,0);
– To the ObjC • –(void)doSomething(NSInteger: foo andInt: NSInteger bar); • Called as [myFunc doSomething:1 andInt:0] • ObjC > 2.0 (OSX 10.5+) supports dot.style.nota+on
• Declaring and alloca+ng a variable. – NSString *myStr; // declare myStr; – myStr = [[NSString alloc] init]; // allocated it – NSString *myStr2 = [[NSString alloc] initWithFormat:@”%s”, @”hello
world”]; // declare, alloc, and populate
5/1/09 16 [email protected]
Objec+ve C / Cocoa
• Common Founda+on Types – NSString – NSData – NSMutableArray – NSURL
• C Types s+ll valid – int, char, etc
5/1/09 17 [email protected]
Objec+ve C / Hello World
• HelloWorld.h #import <Founda+on/Founda+on.h>
@interface HelloWorld : NSObject { // this class has no instance variables }
// we have one instance method ‐ (void)printHelloWorld;
@end
• HelloWorld.m #import "HelloWorld.h"
@implementa+on HelloWorld
// now we implement the instance method ‐ (void)printHelloWorld { // NSLog sends output to the console NSLog(@"Hello World!"); } @end
5/1/09 18 [email protected]
Objec+ve C / Hello World
• Main.m #import <Founda+on/Founda+on.h> #import "HelloWorld.h"
int main (int argc, const char * argv[]) {
HelloWorld *myHW = [[HelloWorld alloc] init];
// Most common view [myHW printHelloWorld];
// ObjC 2.0+ myHW.printHelloWorld;
[myHW release];
return 0; }
• Terminal Build [majer@chimera:hw/] gcc ‐o hello ‐framework Founda+on ‐lobjc main.m HelloWorld.m
• Output 2009‐04‐26 11:07:26.005 hello[29012:807] Hello World! 2009‐04‐26 11:07:26.007 hello[29012:807] Hello World!
5/1/09 19 [email protected]
iPhone Development Model
• iPhone uses Model View Controller paqern – Model: all data related func+onality
– View: all UI related func+onality – Controller: all classes required to for applica+on func+onality • interacts with the other two.
• Nothing prevents programmer from viola+ng the paqern
5/1/09 20 [email protected]
MVC Paqern • Model/Data
– Classes that hold and/or manipulate the data used by the applica+on • Card, CardDeck, AppConfig
– I primarily developed outside of Xcode using vim and a shell prompt • Vim chosen only because of familiarity • Was trying to ease into ObjC and basically performing a 1:1 C++‐>ObjC
transla+on • This means I manually wrote my geqers/seqers
– Thoroughly tested my classes prior to any Xcode/iPhone sdk work began • Unit tes+ng on data model classes performed outside of Xcode environment
– Custom driver that was built using standard gcc/make and run from a shell prompt • Want to ensure that any issues encountered were not caused by issues from
Data Model but were new in the UI code or the Controller code • Try to eliminate as many variables as possible to make debugging easier
5/1/09 21 [email protected]
MVC Paqern
• View – Classes that manipulate the UI of the applica+on
• Created en+rely in Interface Builder, output is a large xml file which, while editable, is difficult to work with. – Drag and drop arrangements of buqons/textboxes/etc. – Items added to view are associated with variables in the controller code also by drag and drop.
• Can be done by hand, almost required to be done by hand for sufficiently complex applica+ons. – Look at ConvertBot for an example of an advanced UI
• 3 Views in my app, Review, Quiz, and Setup
5/1/09 22 [email protected]
MVC Paqern
• Controller – The actual applica+on func+onality. – Interacts with the outlets created in the View – Interacts with the data classes. – Typically 1 controller per view, there were 3 views and 3 controllers in my applica+on. • ReviewViewController • SetupViewController • QuizViewController
5/1/09 23 [email protected]
Quick Demo Time Permi>ng
• Xcode Build – HelloWorld • Xcode Build – Flashcard App • Xcode ‐> Simulator – Flashcard App
• Xcode ‐> iPhone – Flashcard App • Xcode Build – Bubble Level
5/1/09 [email protected] 24
Resources • hqp://developer.apple.com
– Single biggest asset, ar+cle, sample code, etc – Accessible post registra+on/payment
• Online communi+es – (Yahoo|Google) groups – macsb, iphonesb, iphonesdk, iphonesdkdev – High volume mailing lists, good for lurking and searching through
• Programming in Objec+ve‐C – Stephen G Kochan / Developer’s Library
• Good for concepts, however get the 2nd Edi+on, the first has fundamental errors
• Cocoa with Objec+ve‐C – James Davidson & Apple Computer Inc / O’Reilly – Not iPhone specific, geared towards OSX but mostly applicable – Covers MVC and how it applies in reasonable detail
• Beginning iPhone Development – Mark LaMarche / Apress – Good starter book, uses UI Builder
• iPhone SDK Applica+on Development – Jonathan Zdziarski / O’Reilly
• The iPhone Developer’s Cookbook – Erica Sadun / Addison Wesley
5/1/09 25 [email protected]
The First App
• The Idea – Build something you personally need or will use regularly, there’s a good chance someone else will benefit from it • My app created to help me memorize calculus formulas.
• I was the sole/intended customer
– Work with some friends to come up with ideas, everyone has them • Don’t be terribly concerned about “protec+ng your idea” • An idea is nothing without solid execu+on
5/1/09 27 [email protected]
The First App
• The Idea – Try to avoid games for the first app if you haven’t already wriqen them on a Mac before • Amazingly compe++ve
• Higher download counts required to stay on ranking lists
• Bypasses UIBuilder in favor of OpenGL or Quartz • Caveat: Games have the highest upside poten6al in sales
5/1/09 28 [email protected]
The First App • Mone+za+on Models
– Apps are either created with the intent to be free, or with the hope to generate revenue
– Free apps • 2 flavors
– Truly free, download and use, 0 profit for author – Ad driven, download and deal with ads, author gets ad revenue
» AdMob, VideoEgg
– Lite apps • Fully func+onal apps that may not have as many features as the “full” version
– Every feature in a Lite app must work – Can’t have grayed out func+onality – Typically offered as free or inexpensive apps to en+ce buyer
– Pay apps • Fully func+onal apps
– Priced from $.99 (thousands) to $999.99 (1 app called “Am I Rich” which allegedly sold 5 copies)
5/1/09 29 [email protected]
The First App
• The App Store – iTunes – One stop shopping for the i{Pod,Phone} experience. • Es+mated Touch plaporm user base for EOY 2009 @ 50M devices worldwide
– Applica+ons sold along side music and videos – Centralized billing – Sole distribu+on mechanism for legal iPhone applica+ons
5/1/09 30 [email protected]
5/1/09 [email protected] 31
5/1/09 [email protected] 32
5/1/09 [email protected] 33
The First App
• App Store Problems – Visibility
• There are 20k+ apps in the store through which you must wade to find your app
• Hard to search, clunky interface • Ra+ng system issues
– Hard to contest 1 star reviews or people with grudges – Only recently did a user have to have purchased the app to review it
– Too easy to create throwaway account to buy an app to write a scathing review
5/1/09 34 [email protected]
The First App
• App Store Problems – Ra+ng Systems
• Top X Lists – It is cri+cal to stay on those lists to keep the traffic coming – Dropping off the list results in applica+ons being found either by paging or by specific searches » Do you want to page through 20k apps?
• New submissions – Any submission regardless if it’s the ini+al 1.0 submission or the 43rd update are considered new apps on the store
– People game the new app spots by releasing point versions frequently with minor changes
5/1/09 35 [email protected]
The First App
• Determine Marke+ng Strategy – Can be accomplished by issuing demo licenses/keys to review sites
– Adver+sing on ad networks – Press releases – Plan to market your product if you hope to generate revenue from it • Make friends with students in the marke+ng department
5/1/09 36 [email protected]
The First App • Market Research
– Look for compe++on • Not having compe++on any may not be a good thing
– Market could be too small for a single applica+on • There are typically 10 variants on a theme in the app store
– Compe++on != undoable. – Buy the compe+tor apps, dissect them, compare features – Try to build a wining feature set from the other products
• Pay aqen+on to compe+tor pricing to es+mate release price. – 99c is not a sustainable price point. – Most apps cost less than a Starbucks Laqe, people will pay that much for an app. – Don’t forget Apple keeps 30%
• My App • Many flashcard apps, fewer with quizzing ability • Several Calculus formula reference apps • No intersec+on apps that I could find
5/1/09 37 [email protected]
The First App
• Determine Feature Set – Remember: You will most likely be working alone
• There are a finite number of hours in aday and you will need to eat/sleep/go to class
– Based on your market research and mone+za+on model, determine which features would be cri+cal path for 1.0 release and/or the Lite release.
– Take the features that you s+ll want to keep that didn’t make it into 1.0 and plan the 1.1 release at the same +me.
• My App • I knew what I wanted, calculus formulas with the integrals/deriva+ves on the back to aid in memorizing and a quizzer func+onality
• Flexibility to swap out my datasets for things my 3 year old daughter could use
• Prof Fleck added a few to make things more challenging/interes+ng
5/1/09 38 [email protected]
The First App
• Create a Project Plan – Open Project freely available – Es+mate the +me needed to complete desired features for each version planned.
– Double your +me es+mates on first version(s). • At the start of the semester mine were off by as much as 2x as I learned the environment. 3 months later I was much more accurate and could approximate in hours how long things would take me.
• My App • I started on OpenProj then migrated to MS Project • The project plan gave me a guide to where I should be overall • I didn’t always add features in the order they were listed on the plan
5/1/09 39 [email protected]
5/1/09 [email protected] 40
The First App
• Build your corporate/developer Website – Consider building a development blog
• Can be used as a marke+ng tool, a source of beta customers, and a support mechanism
– Open v Closed • Several μISVs have started pos+ng full sales figures and development info to their customers. – Transparency gives customers a warm fuzzy. – Inspiring to other developers as well.
• My app • I have a personal website that I added a bit of func+onality for the card update and phone home features, but otherwise haven’t made it to a real blog/website for the app
5/1/09 41 [email protected]
The First App hqp://www.kalzumeus.com/ ‐ Developer/Personal hqp://www.bingocardcreator.com/ ‐ Corporate
5/1/09 [email protected] 42
The First App hqp://www.seoxys.com/ ‐ Developer/Personal
hqp://excesapp.com/ ‐ Corporate
5/1/09 [email protected] 43
The First App
• Setup a Bug Tracking Database – Many of them out there, pick a free one – Load it with all of the features that you’ve just outlined in your project plan • Mark them closed as you implement the features
– Get in the habit of using it. • I tracked features, real bugs, and ideas • You will eventually have customer reported bugs to put in it
• My App • I originally used any piece of paper on my desk • I copied the notes from about 5 envelopes into an excel spreadsheet which I then used for the rest of the process
5/1/09 44 [email protected]
5/1/09 [email protected] 45
The First App
• Setup a Source Control Repository – Xcode integrates with SVN and several others
• Configure it and get in the habit of using it. – Commit regularly, especially before making large changes to the codebase.
– I’m using both TimeMachine to back up the MBP as well as SVN for my source.
5/1/09 [email protected] 46
The First App
• Develop App (Finally!) – S+ck to the feature list on the plan
• Feel free to push features to next version • Try not to add anything new (beware feature creep)
– Retain those new features in your tracking soaware – Refactor code regularly – Test in Simulator – Test on iPhone – Test on iPod Touch – Consider joining the online communi+es
• macsb, iphonesdk, iphonesdkdev, iphonesb – Make friends with some graphic designers
• You’ll need icons and a general look/feel
5/1/09 47 [email protected]
The First App
• Developing my app • I have on average 1‐2 hours a night and 8‐12 hours on the weekend for over+me/school work/down+me
• When I was home, I worked on average 2‐3 nights a week and at least one weekend day
• First light was aaer 50ish hours across several weeks – Review worked, basic skeleton for Setup screen, Quiz screen would
register buqon presses – That +me wasn’t all coding on my app, there was a substan+al amount of
reading/research/other coding involved • At the next checkpoint the vast majority of features were complete
– All views worked, and the more advanced features were then addressed » Phone home, downloading decks from net, displaying images
(needed for calculus formulas), etc • App is basically feature complete at this +me
– A few things I would do differently based on knowledge I now possess
5/1/09 48 [email protected]
The First App
• Tes+ng – Xcode seems a bit lacking in this regard – My tes+ng was done outside of the Xcode environment from the terminal prompt using standalone drivers
– Didn’t find way to automa+cally test UI • I used family members as testers and observed their use • Firms offer hourly testers to development groups
– Should also consider a method for nightly builds and/or nightly tests and/or automa+c builds.
5/1/09 49 [email protected]
The First App
• Beta Tes+ng – You’ve made it this far, congrats! – Each developer has ~100 devices he can add as development devices
– If you have the blog, send out a request for beta testers
– If you joined the communi+es, ask there. – Find friends/family with devices that can help. – Try to avoid a release without some sort of beta test. – Make sure you test on both the iPod and the iPhone
5/1/09 50 [email protected]
The First App • Retooling/Refactoring
– Since you have all this beta tes+ng data you can now go back and review it • Address Missing features • Fix UI Kludginess • Fix the bugs the first user found on his first use
– Prof Fleck found an issue in my app the very first use, he tried an edge case I didn’t think of because I was too familiar with the app.
– Reiterate the beta as many +mes as you need to get it close to being “shippable” • Realize that “shippable” is a moving target that has many different defini+ons
• My app • Aaer watching my niece and nephew use the app, I realized that the swiping wasn’t
intui+ve to someone unfamiliar with the plaporm – They kept trying to push the arrows at the boqom of the display
• Aaer taking a basic math quiz my nephew (grade 4) then asked “Which ones did I get wrong?” – Enumera+ng wrong answers wasn’t in my ini+al use case as it just didn’t occur to me.
• He also pointed out that I made an error on ’12 + 1 == 11’
5/1/09 51 [email protected]
The First App • Submit to App Store
– Perhaps the single most frustra+ng part of process – There are no official submission guidelines. – There are also no official developer guidelines sta+ng what is and isn’t
acceptable. – This can take as liqle as 1 week up to several months. – Make sure you’ve tested on both the iPhone and the iPod Touch. – You’re basically at Apple’s whim.
• My App • While I intend on submi>ng the app eventually, I will not be submi>ng the
app as it currently stands. • Change Orienta+on • Find a way to integrate MathML to bypass crea+ng image cards for every
formula • Hire a designer to make it pre>er
5/1/09 52 [email protected]
The First App
• Ge>ng an App Rejected – Topics fairly certain to get rejected:
• Obsceni+es • Adult Content • Drugs • Duplica+ng func+onality of exis+ng apps
– Podcast streaming, mail clients, browsers, etc – Being loosened slightly
– Apple is also not consistent in what it approves • Flashlight apps were ok, then pulled, now possibly ok again • iBaby was originally approved, then rejected • A twiqer client was rejected because of the poten+al for adult language.
• Apple claims func+onality is the determining factor yet approves the iFart line of apps
5/1/09 53 [email protected]
The First App
• Support – Congrats on your success! – Now you can look forward to:
• Responding to user emails
• Fixing bugs • Adding user requested features
– You are s+cking to your release plan, right? • Resubmi>ng your app to App Store for acceptance
– Lather, rinse, repeat.
5/1/09 54 [email protected]
The First App
• Endgame – Collect your earnings from Apple
• They take their 30% off the top. – Start planning the next version of the exis+ng app or the next new app.
– Alterna+vely decide that you’re done coding on the iTouch plaporm and go code in Java for Android.
– Re+re – Or in my case, start memorizing
5/1/09 55 [email protected]
5/1/09 [email protected] 56