native ios application development c st 594 – mobile computing

Download Native  iOS  Application Development C ST 594 – Mobile Computing

If you can't read please download the document

Upload: graham

Post on 25-Feb-2016

21 views

Category:

Documents


0 download

DESCRIPTION

Native iOS Application Development C ST 594 – Mobile Computing. Team Members Purva Ajit Huilgol Shruthi Sambasivan Shivani Nayar Xidong Wang Shawn Pike. Overview. Introduction to iOS History Architecture Platform Introduction to Objective-C - PowerPoint PPT Presentation

TRANSCRIPT

Native iOS Application Development CST 594 Mobile Computing

Native iOS Application Development

CST 594 Mobile ComputingTeam MembersPurva Ajit HuilgolShruthi SambasivanShivani NayarXidong Wang Shawn PikeIntroduction to iOSHistoryArchitecturePlatformIntroduction to Objective-CDevelopment environment and Application lifecycle.HelloWorld! AppTableViewsSQLite and Code DataWebservicesLocation services and GesturesJailbreak

Overview

Introduction to iOSThe BeginningsApple's Steve Jobs introduced the iPhone to the world on January 10th, 2007iOS actually began life with a different name: OS XWhen the original iPhone launched, the OS was called "iPhone OS" and it kept that name for 4 years.Its use is extened to iPod Touch, iPad and Apple TV.

iOS 1: The iPhone is bornWindows Mobile, Palm OS, Symbian, and even BlackBerry were all established systems in 2007, with a wide and deep array of features.Comparatively, the iPhone didn't support3Gmultitasking3rd party apps, MMSExchange push email and tethering, it hid the file-system from usersediting Office documentsvoice dialing, and it was almost entirely locked down to hackers and developers.iOS 1: The iPhone is bornFew of the many innovations were revolutionary for the mobile industry.The core iOS user interface.Mobile Safari web browserGoogle MapsVisual voicemailThe software keyboard

iOS 1: The iPhone is bornSome specific iOS updates

VersionYearDevicesFeaturesiOS 1.1

Released 09 /2007iPhone 2G,iPod Touch 1st Gen iTunes Wi-Fi Music Store, iPod Touch compatibilityiOS 2.0Released07 / 2008iPhone 3G & 2G,iPod Touch 1st Gen Native 3rd-party apps, App Store Microsoft Exchange support MobileMe Contact SearchiOS 2.0VersionYearDevicesFeaturesiOS 2.1Released09 / 2008iPhone 3G and 2GiPod Touch 2nd Gen & 1st Gen

Battery life and speed fixesiTunes Genius playlistsDropped call fixesiOS 2.2Released11 / 2008iPhone 3G and 2GiPod Touch 2nd Gen and 1st GenGoogle street viewPodcast downloads

iOS 3.0VersionYearDevicesFeaturesiOS 3.0Released06 / 2009iPhone 3GS, 3G & 2GiPod Touch 2nd Gen &1st Gen Cut, copy, paste Voice Control MMS Spotlight search Push notifications USB & Bluetooth tethering Landscape keyboard Find my iPhoneiOS 3.1Released09 / 2009iPhone 3GS, 3G & 2GiPod Touch 3rd Gen, 2nd Gen and 1st Gen* Genius features Ringtone downloads Remote lock Voice Control over Bluetooth

iOS 3.2 : The iPad arrivesNew UI paradigms for a larger screenleft-hand sidebar listno "back" button required for most appspop-over listNew app designs.dedicated row for bookmarks in SafariPhotos appSkeumorphismThe Notepad appiOS 4.0 : MultitaskingVersionYearDevicesFeaturesiOS 4.0Released06 / 2010iPhone 4,iPhone 3GS,iPhone 3G*,iPod Touch 3rd Gen,iPod Touch 2nd Gen

Multitasking Home screen folders FaceTime video chat Unified email inbox Threaded email messages Retina Display support iAd support

iOS 4.0 UpdatesVersionYearDevicesFeaturesiOS 4.1Released09 / 2010iPhone 4, 3GS & 3GiPod Touch 4th Gen,3rd Gen & 2nd GenGame CenterTV rentalsiTunes PingHDR photosiOS 4.2.1Released11 / 2010iPhone 4, 3GS and 3GiPadiPod Touch 4th Gen,3rd Gen and 2nd GeniPad multitaskingiPad foldersAirPlayAirPrintiOS 4.2.5Released02 / 2011Verizon iPhone 4Verizon supportPersonal hotspot (CDMA)iOS 4.3Released03 / 2011iPhone 4 (GSM),3GS,iPad 1 & 2iPod Touch 4th Gen & 3rd GenPersonal Hotspot (GSM)AirPlay for 3rd-party appsiTunes Home SharingiOS 5.0: Siri & Much MoreSiriNotification CenteriMessageNo PC requirediTunes Wi-Fi SyncOver-the-air updatesiCloudiOS 6 : Goodbye to Google MapsMapsSiri enhancementsNotification Center.Facebook integrationPassbookShared Photo StreamsiCloud Tabs and Reading List enhancementsFaceTime over cellular and better Apple ID integrationiOS : Software Architecture

The Cocoa Touch LayerPrimarily written in Objective-CIs based on the standard Mac OS X Cocoa APIProvides the following frameworks for iPhone app development: UI Kit FrameworkMap Kit FrameworkPush Notification ServiceMessage UI FrameworkAddress UI FrameworkGame Kit UI FrameworkiAd FrameworkEvent Kit UI Framework

UI Kit FrameworkUser interface creation and managementApplication lifecycle managementApplication event handlingMultitaskingWireless PrintingData protection via encryptionWeb and text content presentation and managementConnection to external displaysBlue toothCut, copy, and paste functionalityData handlingInter-application integrationLocal notificationsAccessibilityAccelerometer, battery, proximity sensor, camera.Touch screen gesture recognitionFile sharing

Map Kit FrameworkProvides a programming interface that enables you to build map based capabilities into your own applications.Display scrollable maps for any locationmap corresponding to the current geographical location of the device and annotate the map in a variety of ways.Other FrameworksPush Notification Service : Allows applications to notify users of an event.

Message UI Framework : Allows users to compose and send emails from within the application.

Other FrameworksGame Kit Framework : Provides peer-to-peer connectivity and voice communication

Address Book UI Framework : Enable user to access contact information from the iPhone address book from the application.

Other FrameworksiAd Framework: Allows developers to include banner advertising within their applications.

Event Kit UI Framework: Allows the calendar events to be accessed and edited from within an application.

Processor: 1.3 GHz Dual Core Apple-designed ARMv7s Apple A6 andPowerVR SGX543MP3 (3-Core) GPUMemory: 1GB DRAM

The A6 is said to use a 1.3 GHz custom Apple-designed ARMv7 based dual-core CPU, called Swift.Hardware Details of iPhone5

Objective-CObjective-C is an object-oriented programming language used by Apple primarily for programming Mac OS X and iOS applications. It is a super set of C.Objective-C source code files are contained in two types of files:.h header files.m implementation filesClasses

The @interface Section@interface NewClassName: ParentClassName{ memberDeclarations;}methodDeclarations;@end

Instance variablesClass and instance methods

The @implementation Section@implementation NewClassNamemethodDefinitions;@end

The @class Section@class Classname;

Used as forward declaration to reference another class defined in another file.#import @interface Fraction: NSObject{ int numerator; int denominator;}-(void) print;-(void) setNumerator: (int) n;-(void) setDenominator: (int) d;@endExample

@implementation Fraction-(void) print{ NSLog (@%i/%i, numerator, denominator);}-(void) setNumerator: (int) n{ numerator = n;}-(void) setDenominator: (int) d{ denominator = d;}@endint main (int argc, char *argv[]){@autoreleasepool{Fraction *myFraction; // Create an instance of a FractionmyFraction = [Fraction alloc];myFraction = [myFraction init];[myFraction setNumerator: 1];[myFraction setDenominator: 3];NSLog (@The value of myFraction is:);[myFraction print];}return 0;}Synthesized Accessor Methods

@interface Fraction : NSObject{int numerator;int denominator;}@property int numerator, denominator;

Properties are often your instance variables. The Objective-C compiler automatically generates or synthesize the getter and setter methods using @synthesize directive as shown below.#import Fraction.h@implementation Fraction@synthesize numerator, denominator;

ProtocolsA protocol declares methods that can be implemented by any class.@interface Myclass:NSObject {..}@end; CategoriesA category in Objective-C enables you to add methods to an existing class without the need to subclass it. You can also use a category to override the implementation of an existing class.

Data Types

To write an iPhone application, you have to install Xcode and the iPhone SDK.

https://developer.apple.com/xcode/

EnvironmentFirst iPhone Application

Application Lifecycle

Responding to Interrupts

Moving from Foreground to Background

Moving from Background to ForegroundPublishing app to the App Store

Sqlite (http://www.sqlite.org/index.html) is an open source embedded database. The original implementation was designed by D. Richard Hipp. In 2000 version 1.0 of SQLite was released. This initial release was based off of GDBM (GNU Database Manager). Version 3.0 added many useful improvements.Open source RDBMS.Single File databaseWorks as library not database.Major users of SQLite: Adobe (PS and RE), Apple(mail and Safari), Google (Desktop and Gears) etc..Thus, widely used in testing, analysis and embedded devices. Data Management -SQLite

Add the Framework for SQLite i.e.libsqlite3.0.dylib

In xcode v4+, select project then in project settings editor select summary. Scroll down to frameworks and select add (+).

In the .h file #import sqlite3.h

Open connection with path and file. You can use any file format such as .db, .sql and .sqlite

Configuration Steps

Problem with foreign keySingle userNo proceduresNo securityProblem with 64bit system.SQLite DisadvantagesA table view is an instance of the UITableView class in one of two basic styles, plain or grouped.Table views have many purposes:To let users navigate through hierarchically structured dataTo present an indexed list of itemsTo display detail information and controls in visually distinct groupingsTo present a selectable list of optionsTable Views

Main Window Single View vs Table view bases ArchitecturemainApp DelegateView ControllerScreen viewView ControllerMain Window mainApp DelegateView Controller3Screen viewView Controller3View Controller2Screen viewView Controller2View Controller1Screen viewView Controller1Start a new project.Open Storyboard.Add three table view controllers (TvC1, TvC2, TvC3)Add Navigation Controller: select TvC1, Editor -> Embed in -> Navigation Controller.To connect, select TvC1 drag TvC1 cell to TvC2 toolbar and select push segue. select each table view Cell to give a Identifier in table view cell properties.Select the segue and give the identifier name to each.Create three obj-c classes extended from UITableViewController. Link these classes to the views on storyboard.Add barbuttonItem to each view toolbar and link them to IBAction buttons in respective viewControllers.

Steps

SegueLink the two views using Segue..

Update methods:numberOfSectionsInTableViewNumberOfRowsInSectioncellForRowAt

Built-in management of undo and redo beyond basic text editing.Automatic validation of property values.Maintaining the consistency of relationships among objectsGrouping, filtering, and organizing data in memory and in the user interfaceAutomatic support for storing objects in external data repositories

Core DataA framework that supports creation of model objects that encapsulate your application data and logic in the Model-View-Controller design pattern.https://developer.apple.com/library/mac/#referencelibrary/GettingStarted/GettingStartedWithCoreData/

Create an empty Application * make sure Use Core Data is checked.

Steps

Manage object context: gateway into storing data objects.These data objects belong to the view content. Propagates all the changes to the file systemPersistent storage cordinator: adaptor between files on the device and the application.

Sqlite is used as the database.

A simple Core Data stack

http://developer.apple.com/library/ios/#documentation/DataManagement/Conceptual/iPhoneCoreData01/Introduction/Introduction.html#//apple_ref/doc/uid/TP40008305-CH1-SW1Core data Model

Create classes of each Entity

Update view controller methods to ascess model classes.

Create category (on the top of the existing files) for additional functionally such as sorting, filter rows etc...

Location Service

Location DataLocation:Coordinates (major property),Accuracy,Timestamps, etc.Placemark:An array of strings.

Conversion from Coordinates to Place Name InformationConversion from Place Name Information to Coordinates

GestureSystem TypeTapping Pinching in and out Panning or draggingSwipingRotatingLong pressCustom Typehttp://developer.apple.com/library/ios/#documentation/EventHandling/Conceptual/EventHandlingiPhoneOS/GestureRecognizer_basics/GestureRecognizer_basics.htmlMechanism of gesture

http://developer.apple.com/library/ios/#documentation/EventHandling/Conceptual/EventHandlingiPhoneOS/GestureRecognizer_basics/GestureRecognizer_basics.htmlDiscrete Gesture

http://developer.apple.com/library/ios/#documentation/EventHandling/Conceptual/EventHandlingiPhoneOS/GestureRecognizer_basics/GestureRecognizer_basics.htmlContinuous Gesture

http://developer.apple.com/library/ios/#documentation/EventHandling/Conceptual/EventHandlingiPhoneOS/GestureRecognizer_basics/GestureRecognizer_basics.htmlAdd a built-in gesture recognizer to your appCreate and configure a gesture recognizer instance. This step includes assigning a target, action, and sometimes assigning gesture-specific attributes.Attach the gesture recognizer to a view.Implement the action method that handles the gesture.

http://developer.apple.com/library/ios/#documentation/EventHandling/Conceptual/EventHandlingiPhoneOS/GestureRecognizer_basics/GestureRecognizer_basics.htmlHistoryMajor PlayersReasons To Jailbreak itTechniquesKernel DebuggingThe Current JailbreakLinks

JailbreakHistoryMajor PlayersReasons To Break itKDPXNURWXROPStack Buffer OverflowsHeap Buffer OverflowsHFSTermsKernel DebuggingTechniques- Tools- Stack Buffer Overflow- Heap Buffer Overflow

Kernel DebuggingThe Current JB[1] Objective-c reference, http://developer.apple.com/library/mac/#referencelibrary/GettingStarted/Learning_Objective-C_A_Primer/_index.html#//apple_ref/doc/uid/TP40007594Programming in Objective-C 2.0 by Stephen G. KochanXcode user guide link, http://developer.apple.com/library/mac/#documentation/ToolsLanguages/Conceptual/Xcode4UserGuide/000-About_Xcode/about.html#//apple_ref/doc/uid/TP40010215Developing iOS app, https://developer.apple.com/library/ios/#referencelibrary/GettingStarted/RoadMapiOS/chapters/Introduction.htmliOS development center, developer.apple.comhttps://developer.apple.com/library/ios/#documentation/UserExperience/Conceptual/TableView_iPhone/AboutTableViewsiPhone/AboutTableViewsiPhone.html#//apple_ref/doc/uid/TP40007451-CH1-SW1http://media.blackhat.com/bh-us-11/Esser/BH_US_11_Esser_Exploiting_The_iOS_Kernel_Slides.pdfhttp://antid0te.com/CSW2012_StefanEsser_iOS5_An_Exploitation_Nightmare_FINAL.pdfhttp://developer.apple.com/library/ios/#documentation/EventHandling/Conceptual/EventHandlingiPhoneOS/GestureRecognizer_basics/GestureRecognizer_basics.htmApple Document Location Awareness Programming GuideBook Beginning.iOS5.Development by Dave Mark, Jack Nutting, Jeff LaMarche Harvard Extension School: http://cs76.tv/2012/spring/#l=lectures&r=about&v=lectures/9/lecture9https://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/CoreData/cdProgrammingGuide.html#//apple_ref/doc/uid/TP30001200-SW1References