lecture 1 welcome to ios

Post on 21-Feb-2015

42 Views

Category:

Documents

1 Downloads

Preview:

Click to see full reader

TRANSCRIPT

HIT3329 / HIT8329Creating Data Driven Mobile Applications

Lecture 1Welcome to iOS

Presented by Paul Chapman

Adjunct Lecturer F-ICTDirector, Long Weekend LLC

Swinburne University of Technology

Before We Begin

Lectures & Labs12 x Tuesday Nights

Assignments8 x homework (2 x optional)

Portfolio AssessmentOnly for the brave

RulesNo Copy Paste Coding

RequirementsAccess to Intel MacOO Programming Experience

Textshttp://developer.apple.comhttp://www.cocoadev.com

Q&Ahttp://stackoverflow.compaul at longweekendmobile .com

Swinburne University of Technology

Learning Objectives

1. Build, test, and debug mobile applications that consume and process external data, as well as collect and publish data

2. Explain the importance of and design testable, reusable code components

3. Design mobile applications that work within device and environmental limitations

4. Use caching and concurrency to create fast applications with a better user experiences

Swinburne University of Technology

What Can I Make?

Swinburne University of Technology

Some of Our Work

www.longweekendmobile.com/apps

Japanese Flash Animal Phone

Swinburne University of Technology

What's On For Today?

1.What This Course Is About2.The Learning Curve3.Objective-C4. iOS Developer Tools5.Your First App

Swinburne University of Technology

1.0 What This Course Is About

●Writing apps●Data driven●Networked enabled●Sensor integrated●Touchable●On mobile devices

and it's about ...Swinburne University of Technology

... making it cool!Swinburne University of Technology

What's On For Today?

1.What This Course Is About2.The Learning Curve3.Objective-C4. iOS Developer Tools5.Your First App

Swinburne University of Technology

2.0 The Learning Curve

● iPhone 2G released 2007● iPhone 3G released 2008● Long Weekend started 2009● New, New, New

○ Language○ Hardware○ Tools○ Distribution○ Design Rules

Swinburne University of Technology

2.1 Unfamiliar Language

Message passing syntax object.childObject.value = 1; // Java [[object childObject] setValue:1]; // ObjC 1.0

however ...� object.childObject.value = 1; // ObjC 2.0

Manual memory management [object retain]; // Don't deallocate yet ... // Do some stuff [object release]; // I'm done

Swinburne University of Technology

2.2 Different Hardware

It's not a PC!● Reduced resources (RAM, CPU)● Small screen● Touch interface

Swinburne University of Technology

2.2 Different Hardware II

●Slow unreliable networks●The battery can run out●The phone can ring

Swinburne University of Technology

2.3 The Apple App Store

Playing by the rules● Human Interface Guidelines● Review rules unpublished (until 2010)● Puzzling review process

Swinburne University of Technology

2.3 The Apple App Store II

● Submission lead time (up to 2 weeks)● Bug fixes delayed (up to 2 weeks)● Developer backend is lacking● Even great apps get 1 star reviews

Swinburne University of Technology

What's On For Today?

1.What This Course Is About2.The Learning Curve3.Objective-C4. iOS Developer Tools5.Your First App

Swinburne University of Technology

3.0 Objective-C

●Built on top of C (strict superset)●Objective-C has a runtime●Message Passing●Compiler Directives

Swinburne University of Technology

3.1 Superset of C

Compiler also supports C, C++, ObjC++

Swinburne University of Technology

3.2 The Objective C Runtime

● Object oriented● Introspection● Dynamic typing● Rich Objects

○ Inherited from NSObject○ Feature filled

● Late Binding○ Method names are resolved at runtime○ Can Modify classes at runtime

Swinburne University of Technology

3.4 Message Passing

● Methods are not 'called'● Messages are 'passed' to objects

eg: [object method:someObject];

● Method Signatures○ Most languages: method calls are matched by name○ ObjC: messages are matched by 'signature'

� This C method declaration: (void)doItNow(myString, myArray);

In ObjC: -(void)doItNow:(NSString*)stringArg withArray:(NSArray*):arrayArg;

Matches this signature: 'doItNow:withArray:'

Swinburne University of Technology

3.5 Compiler Directives

● ObjC is built on top of C● Standard C syntax has been extended● Non- standard C syntax often look like this:

@implementation ... @end@interface ... @end@property@synthesize

● Some C syntax has also been "extended" for(id obj in myCollection) // ObjC for loop for(int i=0; i<=5; i++) // Standard C for loop

Swinburne University of Technology

3.6 Source File Structure// example.h - Structure of class header file @interface Classname : SuperClassName { BOOL somethingHappened; // an instance variable int favoriteNumber; // another instance variable}+ (return_type)anotherClassMethod;- (return_type)anInstanceMethod:(param_type)myParam1 with:(param_type)myParam2;@end// example.m - Structure of class implementation file@implementation Classname

+ (return_type)anotherClassMethod { // ... }- (return_type)anInstanceMethod:(param_type)param1 with:(param_type)param2 { // ... }@end

Swinburne University of Technology

What's On For Today?

1.What This Course Is About2.The Learning Curve3.Objective-C4. iOS Developer Tools5.Your First App

Swinburne University of Technology

4.0 iOS Developer Tools

●Xcode 4● Interface Builder●Compiling & Debugging●Cocoa Touch Frameworks

Swinburne University of Technology

4.1 Xcode 4

Class header & implementation files (.m and .h)Swinburne University of Technology

4.2 Xcode 4 - Continued

● Everyone uses it (almost)● Free to download from ADC● Includes Interface Builder● More evolved than Eclipse+Android SDK● Less evolved than Visual Studio

Click through tour of Xcode 4

Swinburne University of Technology

4.3 Interface Builder

User interface resource files (.xib and .nib)

screenshot here

Swinburne University of Technology

4.4 Interface Builder - Continued

● IB creates user interface definitions● XIB/NIB files are class archives

○ a.k.a Frozen classes○ a.a.k.a Serialised classes

● Interfaces can be defined in code too :)● XIB file objects are "plugged in" to classes● IB provides a library of Cocoa interface objects

Click through tour of IBAcronym Alert!

★ NIB = NeXT Interface Builder★ XIB = Mac OS X Interface Builder

Swinburne University of Technology

4.5 Other Tools

Debugging & Profiling ToolsSwinburne University of Technology

4.6 iOS Simulator

Source: http://xcode4iphoneheavenorhell.wordpress.com/

Swinburne University of Technology

4.7 Tethered Debugging

Source: Apple Inc

Swinburne University of Technology

4.8 Version Control

Integrates with SVN + GiT client binaries

screenshot here

Swinburne University of Technology

4.9 Cocoa Touch

"Cocoa Touch provides an abstraction layer of iOS ... Cocoa Touch is based on the Mac OS X Cocoa API toolset and, like it, is primarily written in the Objective-C language. Cocoa Touch allows the use of hardware and features that are not found in Mac OS X computers and are thus unique to the iOS range of devices."Quote Source: http://en.wikipedia.org/wiki/Cocoa_Touch

Cocoa Touch Framework*

FoundationInherited from OS X

Others: Game Kit, Map Kit, Address Book, Messaging, Core Location, Core Audio, Core Graphics, Core Animation, Core Data, etc...

UIKitUI Framework for iOS

* Not indicative of size or importance

Swinburne University of Technology

4.10 Other Included Frameworks

Audio and Video☆ Core Audio ☆

OpenALMedia Library

AV Foundation

Graphics & Animation☆ Core Animation ☆

OpenGL ESQuartz 2D

User ApplicationsAddress Book

☆ Core Location ☆Map KitStore Kit

Data Management☆ Core Data ☆

SQLite

Networking & InternetBonjourWebKit

BSD Sockets

Swinburne University of Technology

What's On For Today?

1.What This Course Is About2.The Learning Curve3.Objective-C4. iOS Developer Tools5.Your First App

Swinburne University of Technology

5.0 Your First App

●Xcode Project Tree●Compiling, Running, Debugging

Swinburne University of Technology

5.1 Xcode Project Tree

Classes*

Resources*�

XIB Files

Property Lists

Frameworks�

Products* Default group names, user changeable

Click through tour of Default Project TreeSwinburne University of Technology

5.2 Compiling, Running, Debugging

● Adding & removing breakpoints● Stepping through code● Logging to console

1. NSLog(@"%@", myString);2. Format specifiers: %d %@ %f %U

● Debugging console commands1. print - prints a value2. po - prints objects (NSObjects)

Swinburne University of Technology

End of Lecture 1

1. Lab Work2. Assignments3. Dream of ObjC

Swinburne University of Technology

top related