Apple iOS 6 Overview @ Copyright Mike Stevens IT Consultant ltd.

28
Apple iOS 6 Overview @ Copyright Mike Stevens IT Consultant ltd

Transcript of Apple iOS 6 Overview @ Copyright Mike Stevens IT Consultant ltd.

Page 1: Apple iOS 6 Overview @ Copyright Mike Stevens IT Consultant ltd.

Apple iOS 6

Overview

@ Copyright Mike Stevens IT Consultant ltd

Page 2: Apple iOS 6 Overview @ Copyright Mike Stevens IT Consultant ltd.

Sizing• iPhone has 320 Width x 480 Height (portrait) coordinates

• iPad has 768 Width x 1024 Height (portrait) coordinates

• iPad is NOT simply 2 iPhones so Apps need 2 different screen layouts for iPhones / iPad

• Different versions of iPhone and iPad have Normal and Retina screens.

• iPhone 4s and iPad 3 Retina screens have twice resolution of pixels within same coordinates– NB:

• Retina screen can display a 1080p HD video compared to 720p Video HD on normal screen.

• Apple Thunderbolt screens (Intel HD graphics) are 1440 and 1440p Video HD exists

• Layout is defined using Left/Right and Top/Bottom Indent coordinates• iPhone Centre is 25, 225 , 300 , 50• iPad Centre is 259, 475, 300, 50

@ Copyright Mike Stevens IT Consultant ltd

Page 3: Apple iOS 6 Overview @ Copyright Mike Stevens IT Consultant ltd.

O/S Functionality• Multi-Tasking – Foreground and Background• Application in Foreground has “full” (within iOS Functionality) capability• Application in Background has “limited” capability• Only 1 App (including taking a phone call) can be in Foreground at ay one time• App states are Initiation, Suspension, Restore and Close• App has to save any data required for ongoing functionality before Suspension• App has to save any data required for ongoing functionality before Close• iPhone and iPad have limited memory – there is no Virtual Memory• Apps should release memory as soon as it is not required.• If iPhone and iPad memory becomes low then iOS will force the closing of apps• Apple Apps have a higher priority for Memory• Connectivity – Mobile/Cellular and Wi-Fi • Apple, Telecom operators and User £ bills prefer Apps with Wi-Fi connectivity• User Input – Multi-touch (more than just Keyboard) , Accelerator & Gyroscope• User Feedback – Screen (Text, Images, Video, Audio) and Vibrations

@ Copyright Mike Stevens IT Consultant ltd

Page 4: Apple iOS 6 Overview @ Copyright Mike Stevens IT Consultant ltd.

Application Development

• Can only be undertaken using Mac Computer• Apps developed using Xcode Integrated Development Environment (IDE)• Apps in development mode are active for 120 days• Apple development license required to Publish Apps via App Store• Apple development license is $100 per year • Apps can be tested using MAC Simulator or “development” iPhone/iPad• iPhone/iPad in “development” mode need Apple development license .• Apple Objective C (was NextGen C for Unix) is Object Orientated code• Cocoa Touch is the Framework set of Classes for Object creation.• Model – View – Controller (MVC) is development methodology• An Xcode project is a collection of app code and build settings• Xcode has a number of pre-defined project types and build targets.• Build targets are either iPhone, iPad or Universal (iPhone and iPad)• Code has to be carefully targeted against iOS current and previous

version(s)

@ Copyright Mike Stevens IT Consultant ltd

Page 5: Apple iOS 6 Overview @ Copyright Mike Stevens IT Consultant ltd.

Xcode IDEMenu Options

Toolbar

Build & Run Options Code Section Menu Editor OptionsView Options

Navigator Icons Editor Viewer Utility Viewer

Navigator Files

@ Copyright Mike Stevens IT Consultant ltd

Page 6: Apple iOS 6 Overview @ Copyright Mike Stevens IT Consultant ltd.

Symbol Elements• Framework Class #Includes• View Controllers• Class Objects defined as (id), (void) and (IBAction)• Variables• Labels• Actions• Properties and synthesize• // Reminder Notes• #Pragma marks with “label name” to create app specific code sections• Implementation files *.m

– definitions of #imports, @Interfaces , @Properties and –IBAction's

• Interface files *.h– Functionality code for @interfaces, @implementations, @synthesize, -(id), -(void) –IBAction’s

NB # is Alt (Option) 3 on Keyboard

@ Copyright Mike Stevens IT Consultant ltd

Page 7: Apple iOS 6 Overview @ Copyright Mike Stevens IT Consultant ltd.

Code Building / Testing

• Compiling - Compile code into Application• Linking – Link App Code with Frameworks• Target – Mac Simulator or connected iPhone / iPad• Configuration – Debug (default) or Release (App Store)• Errors (shown in Red) will stop Compiling process• Warnings (shown in yellow) will Compile but may cause issues.

• Deprecated code cannot be corrected if previous iOS version are supported within App

• Logic Problems (shown in blue) will Compile but may cause problems• Snapshots are a Copy of Code in a time period

• Created Manually or for each Build• Can be Restored on a line by line basis

• Testing is within iPhone or iPad Simulator or a Development iPhone / iPad• Testing is for specific iOS, e.g. iOS 6 or earlier version for regression testing

@ Copyright Mike Stevens IT Consultant ltd

Page 8: Apple iOS 6 Overview @ Copyright Mike Stevens IT Consultant ltd.

Project Properties

• Defined with a Info.plist file• iPad / iPhone Screen Icons – Image and 8 letters

– must not look like or sound like Apple icons

• Launch Images – if there is a lot of app start code – not a good usability idea• Supported Device Orientations, e.g. Portrait, Landscape , etc , etc• App does Not Run in Background, i.e. it simply closes.• App uses Wi-Fi or Mobile/Cellular – not all iPADs have Mobile/Cellular capability• App Help File location• Minimum iOS version – Has there been any Deprecated code changes?• Minimum iPhone / iPad version – are there any image detail• Etc, etc

• iPhone 1,2 ,3 and 4 (normal) icons are 57 x 57 pixels• iPhone 4+ (retina) icons are 114 x 114 pixels • iPad 1 and 2 (normal) icons are 72 x 72 pixels• iPad 3 (retina) icons are 144 x 144 pixels

@ Copyright Mike Stevens IT Consultant ltd

Page 9: Apple iOS 6 Overview @ Copyright Mike Stevens IT Consultant ltd.

Object C• Object Orientated Programme (OOP) both within Code Syntax and Structure

• Class Header/Interface and Implementation Files for encapsulation• Sub-Class imports and builds on Framework class for inheritance• Object is an Active Instance of a Class with an implementation.• Singleton class is only Instantiated into an object once during life of App• Instance Action is code to define the specific app object functionality .• Property (instance variable) is code to define Specific App Object Values

– Property and Variable Name are assumed to be the same and only accessed via Property.

• IBAction’s call a Action using its Name• Synthesize reads and set Property values using its Name• Names should be meaningful.• Object are utilised within Own Object (self) or by External Object Interface Name• Object Variable Types are NSString, NSDate and NSURL• Object Types can also be IBAction(Event), ID (Unknown) or Void (No return value)• Object Screen Types are Label, Text, Button, Switch, Segmented, Sliders, etc, etc,• Primitive Data Types are int (1,2.3), float (1.1, 1.2, 1.3) and double (floating point)

@ Copyright Mike Stevens IT Consultant ltd

Page 10: Apple iOS 6 Overview @ Copyright Mike Stevens IT Consultant ltd.

Coding• Declare Variables with Object/Primitive Type and Name• Allocating and Initialising Objects with Name , alloc and Init• Use Object Type Casting for unknown Object Type• Use Object Instance Code with Object Name Action Name:@ Parameter Value • Use Object Handler Code Blocks for Event Actions, e.g. Button Pressed • Use Object Properties for Object Instance Values• Make App Functional Decisions using Expressions, e.g. Compare, >, < , etc

– ==: means are values equal, !=: means are values not equal– &&=: is the And condition, || is the OR condition and !: is the NOT condition– ++ means add 1 to Variable number and – means reduce 1 from Variable number– If and Else branching– Switch and Case / Default branching– For (initialisation, condition, update value) looping– While (expression valid) looping

• Release Memory with Automatic Reference Counting / Self.Object Name:nil

@ Copyright Mike Stevens IT Consultant ltd

Page 11: Apple iOS 6 Overview @ Copyright Mike Stevens IT Consultant ltd.

Cocoa Touch Supporting Layers

Cocoa TouchMediaCore ServicesCore OS

90+ % of App functionality developed using Cocoa Touch Framework classes

Each new Version of iOS adds new Cocoa Touch Framework Functionality

@ Copyright Mike Stevens IT Consultant ltd

Page 12: Apple iOS 6 Overview @ Copyright Mike Stevens IT Consultant ltd.

Cocoa Touch Supporting Layer Frameworks

Cocoa Touch UIKit – for App Launch/Terminate/Multi Tasking/Touch InterfaceMapKit for Google (IOS 1 to 5) and Apple (IOS6) MapsGameKit for Games and Peer to Peer Networks Session & DiscoveryMessageUI / AddressBookUI / EventKitUI for Email IntegrationsSocial for Social Media integrations, e.g. Twitter and FacebookiAD for inclusion of Apple managed Adverts into AppsPass Kit for downloadable passes, e.g. coupons, boarding passes, etcReminders for creating and accessing time and proximity alerts

Media AV for Audio VideoCore Audio for Playback and Recording inc Alerts and VibrationsCore Images for Images including VideoCore Graphics for 2D DrawingCore Text for Text processingCore IO for Input / Output Image DataMedia Player for Movie PlaybackOpen GL ES for 2D and 3D AnimationQuartz Core for Hardware Capability Animation

@ Copyright Mike Stevens IT Consultant ltd

Page 13: Apple iOS 6 Overview @ Copyright Mike Stevens IT Consultant ltd.

Cocoa Touch Supporting Layer Frameworks

Core Services

User Account DataAddress (Contact) Book DataCFNetwork – BSD Sockets (Winsock/TCPIP), HTTP/FTP and BonjourCore Data – Data Model using SQLite DBCore Foundation – C Framework (not used directly by iOS)Foundation – Objective C wrapper for Core FoundationEvent Kit – Access Calendar Information and EventsCore Location – Latitude/Longitude GPS / Wi-FiCore Motion – Motion Events inc Accelerometer / GyroscopeQuick Look – File Viewing including unknown download itemsStore Kit – Purchases within Application via Apple App StoreSystem Config – Current Network Config and Device Availability

Core OS Accelerate – Complex Calculations including Digital Signal ProcessingExternal Accessory – Interfaces via Dock Connector and BluetoothSecurity – Cryptographic functions (encrypt/decrypt) inc Keychain.System – Standard Unix Functionality

@ Copyright Mike Stevens IT Consultant ltd

Page 14: Apple iOS 6 Overview @ Copyright Mike Stevens IT Consultant ltd.

UIKit Simplified Application Processing

UIKit Framework Application Code

User Taps App IconApp Initialises into Foreground

Application:didFinishLaunchingwithOptions• Create View• Create View Controller• Create Objects within View• Create Actions and Properties

User Taps Screen within Event Loop Handle Event Code via View Controller

User Taps Home ButtonApp Quits Foreground

Application:applicationWillResignActive

App Moves to Background Application:applicationDidEnterBackgroundSave Data to Restart App in same state using UIStatePreservation class functionality

@ Copyright Mike Stevens IT Consultant ltd

Page 15: Apple iOS 6 Overview @ Copyright Mike Stevens IT Consultant ltd.

Core Cocoa Touch Application Classes

Core NSObject Allocation and Initialisation

UIApplication Events & Configuration

UIWindow Management & Display of ViewsIs a Single Instance of an Object within ApplicationAutomatically Created by iOS

UIView Defines Display of Objects within a Specific ViewPart of a Hierarchy of Views within UIWindowMain View and then Sub Views connected via Segues

UIViewController Management of Views and Implementation of Events.

UIControls Controls within Views, e.g. Text, Label and Buttons• Use of Control triggers an Event with an Action Interface.

UIResponder User Touch Responses to UIControls with Events.• A First Responder is for the Control that Triggers the Action

@ Copyright Mike Stevens IT Consultant ltd

Page 16: Apple iOS 6 Overview @ Copyright Mike Stevens IT Consultant ltd.

Core Cocoa Touch Application Classes

Data Types Class Property

NSString (static) or NSMutableString (can be changed)NSArray or NSMutableArray - uses Numeric Index numberNSDictionairy or NSMutableDictionairy – uses key pairsNSNumber or NSDecimalNumberNSDate with comparison functions, e.g. earlier dateNSURL is a String plus String lookup functions, e.g. host URLNSData (static) and NSMutableData for distributed objectsNSError with Property values indication error details

User Controls Class Objects

UILabel, UITextField (single row), UITextView (multiple rows), UIPickers, UISwitch, UIButton, UISegmentedControl, UISlider, UIStepper and UIPopOverController (iPad only)

@ Copyright Mike Stevens IT Consultant ltd

Page 17: Apple iOS 6 Overview @ Copyright Mike Stevens IT Consultant ltd.

Cocoa Touch Application Project Templates

Master-Detail iPad Only Navigation Controller and Split View

OpenGL Game iPhone / iPad OpenGL ES-based Game View, Scene and Timer

Page-Based iPhone / iPad Page View Controller

Single View iPhone / iPad View Controller, Scene, Storyboard and View.

Tabbed iPhone / iPad Tab Bar Controller and View Controller for Tab Bar it

Utility iPhone / iPad Main & Alternative View with Info button to flip Views

@ Copyright Mike Stevens IT Consultant ltd

Page 18: Apple iOS 6 Overview @ Copyright Mike Stevens IT Consultant ltd.

Cocoa Touch Storyboards and Views

Storyboards XML Files containing Scene(s)Different for iPhone and iPad Scene(s)

Scene Defines Each Scene within StoryboardEach Storyboard can 1 or more Scene

View Controller Each Scene has a View Controller which connects Screen Control Objects with Actions and Properties within Implementation files *.m and Interface files *.h.There is 1 View Controller for a Scene

View Contains View ObjectsThere is 1 View for a View Controller

First Responder Defines Current User Control Objects

Segue Links Views to Views via User Control Objects

Utilities Inspectors and Library functionality within Utility Viewer part of IDE

Inspectors Allows values to be set within IDE for Files, Identity, Inspector, Attributes, Size and Connections within Storyboard

Libraries Allows values to be set within IDE for File, Code, Object and Media.

@ Copyright Mike Stevens IT Consultant ltd

Page 19: Apple iOS 6 Overview @ Copyright Mike Stevens IT Consultant ltd.

Universal App (iPhone and iPad) in Single App

@ Copyright Mike Stevens IT Consultant ltd

Option 1 (Default)

Different Storyboards for iPhone and iPad Model View Controller – View

Different View Controllers for iPhone and iPad Model View Controller – Controller

Distinct Classes for iPhone and iPad specific functionality Model View Controller – Controller

Common Classes for iPhone/iPad common functionality Model View Controller – Model

Use UIDeviceCurrentDevice.model to determine of iPhone or iPad Model View Controller – Controller

Option 2 Use Targets to Build for iPhone or iPad as 2 separate Apps Project Build Settings

Page 20: Apple iOS 6 Overview @ Copyright Mike Stevens IT Consultant ltd.

Creating Project & View LayoutsProject Menu Options: File, New Project, Application Template Type, e.g.

Master/Detail or Single View (which is also used for multiple views) and Name Details (use Main for Class prefixes)

Storyboards Menu Options: File, New, File, User Interface, Storyboard.Must have Different Storyboards for iPhone and iPadSingle Click on Storyboard file in IDE Navigator to display Canvas.

Objects Library To Display View Controller, Label, Text, etc within IDE Utilities Identity Inspector use Menu Options: View, Utilities, Show Object Library.

Scene Drag View Controller from Object Library to Canvas to create View Controller Scene (with View and First Responder) and Implementation and Interface files. Set meaningful Custom Class Name e.g. Main or Add_ItemDetail.Add another View Controller for multiple View layouts onto Canvas.

User Controls Drag Text, Label, Button, etc from Object Library to View. Double Click on Object to add meaningful text.Layout View using Menu Options: Editor, Align and shown options

Segue Ctrl Drag from appropriate User Control Object (e.g. Button) within Starting View to New View and Select Type: Push, Modal or Custom

@ Copyright Mike Stevens IT Consultant ltd

Page 21: Apple iOS 6 Overview @ Copyright Mike Stevens IT Consultant ltd.

Creating Code FunctionalityObjects Library To Display View Controller Interface File (.h) within IDE alongside

Storyboard Canvas use Menu Options: View, Assistant Editor and Show Assistant EditorSelect correct View Controller Interface .h file with single click

Properties Ctrl Drag from appropriate User Control Object (e.g. Labels and Text) within View to the correct View Controller's interface .h file below to @interface to create @property IBOutlet connectionSet options as Connection: Outlet, Name: Meaningful Name, Type: Object Type and Storage: Strong

Actions Ctrl Drag from appropriate User Control Object (e.g. Button) within View to the correct View Controller's interface .h file to create -(IBAction) connectionsSet options as Connection: Action, Name: Meaningful Name, Type: ID, Event: Touch Up Inside (button touched) and Arguments: Sender

Synthesize Select correct View Controller Implementation .m file with single clickManually add @synthesize code for each property created above.

Functionality Manually add required functional code to –(IBAction) for the appropriate User Control object within correct View Controller Implementation .m file

@ Copyright Mike Stevens IT Consultant ltd

Page 22: Apple iOS 6 Overview @ Copyright Mike Stevens IT Consultant ltd.

Model, View and Controller (MVC)

Model Shared Business Functionality using Named Delegate Handler Code Blocks• NB: By default functionality is within each View Controller (referenced via self)• This depends on the complexity of application functionality.Where the Core Data Model using SQLite DB is used.

View Storyboard Views with User Control Objects for Presentation to User

Controller View Controller with Interface Outlet Properties and Event Method Actions

@ Copyright Mike Stevens IT Consultant ltd

View display the Presentation Layer (iPhone / iPad screen) to User.

User Actions within View are implemented via Controller Interface Properties and Actions code.

The Controller implements the Business Functionality via Local (self) or Shared Model Interface code.

The Model (or Local) code returns the results of the Business Functionality to Controller.

Controller returns the results of the Business Functionality as Presentation changes to View.

View changes Presentation to User.

Page 23: Apple iOS 6 Overview @ Copyright Mike Stevens IT Consultant ltd.

Application Data

Preferences Application Preferences with Default ValuesUser Preference Settings within App Settings within Apple Settings AppUser Defaults are configured as Setting Bundles as Singleton Key/Value PairsSetting Bundles are added to Project as a Root.plist Resource FileUser Default values saved in Default DB which is part of iTunes/iCloud BackupValues accessed via NSUserDefaults standardUserDefaultsChanged values (from defaults) are saved via NSUserDefaults Synchronize

App Values Saved into Directory as File Values or into Core Model using SQLite DBApplication can only access data within its own Application DirectoryFiles are accessed via NSFileManager and NSFileHandlerFor Security reasons there is NO Application to Application Directory Access• NB: This is not a technical restriction but an Apple policy.• If you do not follow policy then the app will not be approved for Apple App Store !!!!!• User will be asked for any integrations with Contacts, Calendar, Reminders or PhotosApp Directories are Library/Preferences, Library/Cache, Documents and TmpFile space (like Memory) is limited so should be kept to a minimum at all times.Directory Path is identified using NSSearchPathForDirectoryinDomain

@ Copyright Mike Stevens IT Consultant ltd

Page 24: Apple iOS 6 Overview @ Copyright Mike Stevens IT Consultant ltd.

Orientation and Accelerator Impacts

@ Copyright Mike Stevens IT Consultant ltd

• App should support Orientation, Rotation, Portrait, Landscape and Upside down layouts• If App does not support these layouts then this need to be defined within app config• Use shouldAutoRotatetoInterfaceOrientation(parameter) = True/False• Parameters are Portrait, Portrait Upside Down, Landscape Left and Landscape Right.• Landscape and Portrait have same Area but need different View layouts• Options are:

– Use 2 Different Views with Common/Model Block Code Actions– Use Core Graphics CGRectMake to reset coordinates for a Single View User Controls– Use IDE Size Inspector to resize View User Controls using Horizontal/Vertical Anchors.

• App may support (if required) Accelerator (Movement and Tilt) iOS capability• Amount of use of Accelerator is defined using X and Y axis values• App has to be set to receive X/Y value notifications using UIDevice NSNotificationCentre • App receive notifications via CoreMotion CMMotionManager Handler Code Block

Page 25: Apple iOS 6 Overview @ Copyright Mike Stevens IT Consultant ltd.

Address Book (Contact) and Email Integration

@ Copyright Mike Stevens IT Consultant ltd

• Address Book is a central set of Contacts for all apps – Apple policy is not to create a separate list within an App

• Integrate using AddressBook and AddressBookUI frameworks• AddressBookUI provides Browse, Search, Select, Edit and Create New

functionality– iPhone display a model view and iPad displays a Master-Detail view or a Custom Code view

• Use ABPeoplePickerNavigationController class• Class requires Delegate Handler Code Blocks:

– ABPeoplePickerNavigationControllerDelegate didCancel – ABPeoplePickerNavigationControllerDelegate shouldContinueAfterSelectingPerson

• Email Integration uses Default Email defined in Apple iOS Settings• Use MFMailComposerViewController• Add Text Value(s) for Email Address(s) using setToRecipientsArray method• Display View with presentModelViewController method• Class requires Delegate Handler Code Block for didFinishWithResult

Page 26: Apple iOS 6 Overview @ Copyright Mike Stevens IT Consultant ltd.

SOAP Web Service Integration

@ Copyright Mike Stevens IT Consultant ltd

• Use NSURL• Define XML SOAP String within an NSString • Create a Soap Envelope within NSData using XML SOAP String• Define Web Service URL within an NSString • Create a HTTP Soap Request within an NSMutableURLRequest using Web Service URL• Define SOAP Function Name within an NSString, e.g. domain name/function• Add to HTTP Soap Request the SOAP Function Name as a SOAP Action• Add to HTTP Soap Request the HTTP Method, e.g. Post• Add to HTTP SOAP Request the HTTP Body, e.g. Envelope• Add to HTTP SOAP Request the Charset and Content-Type• Add to HTTP SOAP Request the Envelope and Content lengths• Make Network TCPIP connection using NSURLConnection class• Class Requires Delegate Handler Code Block for Connection results:

– didReceiveConnection to utilise NSURLResponse– didReceiveData to utilise NSData value within NSURLResponse– didFailWithError to utilise NSError values – connectionDidFinishLoading to utilise NSString XML Values within NSURLResponse

Page 27: Apple iOS 6 Overview @ Copyright Mike Stevens IT Consultant ltd.

More details can be obtained from Apple

• https://developer.apple.com/devcenter/ios/index.action

• https://developer.apple.com/library/prerelease/ios/#documentation/Miscellaneous/Conceptual/iPhoneOSTechOverview/Introduction/Introduction.html#//apple_ref/doc/uid/TP40007898

• https://developer.apple.com/library/prerelease/ios/#documentation/UserExperience/Conceptual/MobileHIG/Introduction/Introduction.html#//apple_ref/doc/uid/TP40006556

• https://developer.apple.com/library/prerelease/ios/#documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/Introduction/Introduction.html#//apple_ref/doc/uid/TP40007072

@ Copyright Mike Stevens IT Consultant ltd

Page 28: Apple iOS 6 Overview @ Copyright Mike Stevens IT Consultant ltd.

Thanks

http://www.mikestevensitweb.com

@ Copyright Mike Stevens IT Consultant ltd

Mike Stevens IT Consultant

0777 566 3713