Upload
others
View
0
Download
0
Embed Size (px)
Citation preview
iPhone Application Development
Getting Started with the hottest smart phone!
By: Muhammad Ali
Agenda • Why Bother About iPhone Application Development?
• Requirements for Developing iPhone Apps o The Legal Way
• Development to Device o Languages, Tools & Frameworks
• Quick Tour of Objective-C
• Hello World
• Helpful Resources
• Summing Up
iPhone Application Development -‐‑ The Why
iPhone Application Development – The Why
• Why Android Based Smartphone Sales are Touching Skies?
• &
o Android apps count: 380,297 (as of Jan 2012) • iOS apps count: 550,000 (as of Jan 2012) • Android has 10,000 more free apps!
o Android Mobile OS Share: 46% • iOS Share: 30%
67% 61%
39% 37%
26% 26%
Percent free of charge applications
as of May 2011 Source: Wikipedia
What Developers Say?
Source: Appcelerator
Don’t Worry About OS Share. Gap is GeJing Closer!
For US Only
Still Not Convinced?
For US Only
A journey of thousand miles begin with a single step ~
Lao-‐‑Su
iPhone Application Development – The How
iPhone Application Development – The How
• Requirements o For Business Man
• Developer Account o $99 (iOS Developer Program), $299 (iOS Developer Enterprise
Program) • via Credit Card
o Takes up to 3-12 working days o (http://developer.apple.com/programs/)
o For Educational Institutes • iOS Developer University Program Enrollment (Free!)
o For Developer • Apple ID – Free (To Access iPhone SDK & Resources)
o (http://developer.apple.com/) • Intel-based Mac running Mac OS X 10.6 (Snow Leopard) or later (Latest:
Mac OS X 10.7 Lion) o Most economical choice: Mac Mini ~ PKR 60K
iPhone Application Development – The How • For Application
o Two Icons of 57x57 & 512x512 (of same design) o Splash Screen of 320x460 or 320x480 o And the Application of course.
Languages, Tools & Frameworks
Application Types • Native
o Reside Completely on iPhone
o Advantages: Offline Access, Increase Performance, Device Features o Disadvantages: Device Specific Code, Learning Curve
• Web o Websites made for iPhone (Can make UI similar to native apps)
o Advantages: Known Technologies, Low Development Cost, Standard Tools o Disadvantages: Reduced User Experience, No Offline Access
Application Types • Hybrid
o Combines the two.
o Advantages: You can have best of two worlds. o Disadvantages: Integration & Manageability needs extra care
Languages, Tools & Frameworks
• Native o Language
• Objective-C
o Tools • Xcode, InterfaceBuilder, iOS Simulator
o Frameworks • iOS SDK
Languages, Tools & Frameworks
• Web o Language
• JavaScript, HTML/CSS
o Tools • Standard Web Development Tools
o Frameworks • Any compatible framework.
iOS Architecture
Figure: Applications layered on top of iOS
Figure: Layers of iOS
Source: iOS Developer Library
Quick Tour of Objective-‐‑C • File Extensions
o .h (Header files), .m (Objective-C & C code), o .mm (can contain C++ code, in addition to Objective-C & C code)
• #import o Recall #include but in an improved way!
• @interface o Declares the class name, methods, properties, etc.
• @end o Marks the end of an interface declaration or implementation
• @Property o Getter/Setters – Automatically generated
Quick Tour of Objective-‐‑C
Source: iOS Developer Library
Quick Tour of Objective-‐‑C • Methods
o In C++/C#/Java, you typically call method as • obj.someMethod( );
o In Objective-C, the same call would be • [obj someMethod];
o Parameterized calls in C++/C#/Java typically are like • Declaration: Inside class, void someMethod(int param) • Call: obj.someMethod(12);
o In Objective-C, • Declaration: -(void) someMethod: (int) • Call: [obj someMethod:12]; • Call: [obj someMethod param:12];
Quick Tour of Objective-‐‑C
Quick Tour of Objective-‐‑C • Declared Properties
o copy – Copy the object during the assignment o readonly – Declare only getter method
o @synthesize • Generate the methods as per specification
• Protocols o Declares methods that a class must implement o Like interfaces in C#/Java
Quick Tour of Objective-‐‑C • Memory Management
o Garbage Collection • A ‘garbage collector’ controls the lifetime of an object • Not available for iOS!
o Automatic Reference Counting (ARC) • Compiler controls the lifetime of an object
o Manual Reference Counting (MRC) • Programmer controls the lifetime of an object
o retain • Increments the reference count by 1
o release • Decrements the reference count by 1
o autorelease • Reference count will be decremented at some time in future
o Reference count is 1 when an object is created
Design PaJerns • Delegate
o Helps you add functionality without sub-classing
• Model View Controller o Model
• Objects representing the data o View
• Objects know how to display data and handle user interactions o Controller
• Mediate between views and controllers
• Target Action o Allows a control object (e.g. a Button) to send another object a
meaningful message in response to a user-initiated event
Application Life Cycle
Source: iOS Developer Library
Hello World! Demo
Publishing the App
Helpful Resources • Apple Developer Resources
o http://developer.apple.com/resources/
• iOS Dev Center o http://developer.apple.com/devcenter/ios/index.action
• iOS Developer Library o http://developer.apple.com/library/ios/navigation/index.html
• Xcode o http://developer.apple.com/technologies/tools/
• Objective-C Guide o HTML [Link], PDF [Link]
• Got into a fix? Use Google!
Summing Up
Thank You!