Native i OS Application Development CST 594 Mobile
Native i. OS Application Development CST 594 – Mobile Computing Team Members Purva Ajit Huilgol Shruthi Sambasivan Shivani Nayar Xidong Wang Shawn Pike
Overview a Introduction to i. OS History Architecture Platform a Introduction to Objective-C a Development environment and Application lifecycle. a Hello. World! App a Table. Views a SQLite and Code Data a Webservices a Location services and Gestures a Jailbreak
Introduction to i. OS The Beginnings Apple's Steve Jobs introduced the i. Phone to the world on January 10 th, 2007 i. OS actually began life with a different name: OS X When the original i. Phone launched, the OS was called "i. Phone OS" and it kept that name for 4 years. Its use is extened to i. Pod Touch, i. Pad and Apple TV.
i. OS 1: The i. Phone is born Windows Mobile, Palm OS, Symbian, and even Black. Berry were all established systems in 2007, with a wide and deep array of features. Comparatively, the i. Phone didn't support 3 G multitasking 3 rd party apps, MMS Exchange push email and tethering, it hid the file-system from users editing Office documents voice dialing, and it was almost entirely locked down to hackers and developers.
i. OS 1: The i. Phone is born Few of the many innovations were revolutionary for the mobile industry. The core i. OS user interface. Mobile Safari web browser Google Maps Visual voicemail The software keyboard
i. OS 1: The i. Phone is born Some specific i. OS updates Version Year Devices Features i. OS 1. 1 Released 09 /2007 i. Phone 2 G, i. Pod Touch 1 st Gen • i. Tunes Wi-Fi Music Store, • i. Pod Touch compatibility i. OS 2. 0 Released 07 / 2008 i. Phone 3 G & 2 G, i. Pod Touch 1 st Gen • Native 3 rd-party apps, • App Store • Microsoft Exchange support • Mobile. Me • Contact Search
i. OS 2. 0 Version Year Devices Features i. OS 2. 1 Released 09 / 2008 i. Phone 3 G and 2 G i. Pod Touch 2 nd Gen & 1 st Gen Battery life and speed fixes i. Tunes Genius playlists Dropped call fixes i. OS 2. 2 Released 11 / 2008 i. Phone 3 G and 2 G i. Pod Touch 2 nd Gen and 1 st Gen Google street view Podcast downloads
i. OS 3. 0 Version Year Devices Features i. OS 3. 0 Released 06 / 2009 i. Phone 3 GS, 3 G & 2 G i. Pod Touch 2 nd Gen & 1 st Gen • Cut, copy, paste • Voice Control • MMS • Spotlight search • Push notifications • USB & Bluetooth tethering • Landscape keyboard • Find my i. Phone i. OS 3. 1 Released 09 / 2009 i. Phone 3 GS, 3 G & 2 G i. Pod Touch 3 rd Gen, 2 nd Gen and 1 st Gen* • Genius features • Ringtone downloads • Remote lock • Voice Control over Bluetooth
i. OS 3. 2 : The i. Pad arrives New UI paradigms for a larger screen left-hand sidebar list no "back" button required for most apps pop-over list New app designs. dedicated row for bookmarks in Safari Photos app Skeumorphism The Notepad app
i. OS 4. 0 : Multitasking Version i. OS 4. 0 Year Released 06 / 2010 Devices i. Phone 4, i. Phone 3 GS, i. Phone 3 G*, i. Pod Touch 3 rd Gen, i. Pod Touch 2 nd Gen Features • Multitasking • Home screen folders • Face. Time video chat • Unified email inbox • Threaded email messages • Retina Display support • i. Ad support
i. OS 4. 0 Updates Version Year Devices Features i. OS 4. 1 Released 09 / 2010 i. Phone 4, 3 GS & 3 G i. Pod Touch 4 th Gen, 3 rd Gen & 2 nd Gen Game Center TV rentals i. Tunes Ping HDR photos i. OS 4. 2. 1 Released 11 / 2010 i. Phone 4, 3 GS and 3 G i. Pad i. Pod Touch 4 th Gen, 3 rd Gen and 2 nd Gen i. Pad multitasking i. Pad folders Air. Play Air. Print i. OS 4. 2. 5 Released 02 / 2011 Verizon i. Phone 4 Verizon support Personal hotspot (CDMA) i. OS 4. 3 Released 03 / 2011 i. Phone 4 (GSM), 3 GS, i. Pad 1 & 2 i. Pod Touch 4 th Gen & 3 rd Gen Personal Hotspot (GSM) Air. Play for 3 rd-party apps i. Tunes Home Sharing
i. OS 5. 0: Siri & Much More… Siri Notification Center i. Message No PC required i. Tunes Wi-Fi Sync Over-the-air updates i. Cloud
i. OS 6 : Goodbye to Google Maps Maps Siri enhancements Notification Center. Facebook integration Passbook Shared Photo Streams i. Cloud Tabs and Reading List enhancements Face. Time over cellular and better Apple ID integration
i. OS : Software Architecture
The Cocoa Touch Layer Primarily written in Objective-C Is based on the standard Mac OS X Cocoa API Provides the following frameworks for i. Phone app development: UI Kit Framework Map Kit Framework Push Notification Service Message UI Framework Address UI Framework Game Kit UI Framework i. Ad Framework Event Kit UI Framework
UI Kit Framework User interface creation and management Application lifecycle management Application event handling Multitasking Wireless Printing Data protection via encryption Web and text content presentation and management Connection to external displays Blue tooth Cut, copy, and paste functionality Data handling Inter-application integration Local notifications Accessibility Accelerometer, battery, proximity sensor, camera. Touch screen gesture recognition File sharing
Map Kit Framework Provides a programming interface that enables you to build map based capabilities into your own applications. Display scrollable maps for any location map corresponding to the current geographical location of the device and annotate the map in a variety of ways.
Other Frameworks Push 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 Frameworks Game Kit Framework : Provides peer-to-peer connectivity and voice communication Address Book UI Framework : Enable user to access contact information from the i. Phone address book from the application.
Other Frameworks i. Ad 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.
Hardware Details of i. Phone 5 Processor: 1. 3 GHz Dual Core Apple-designed ARMv 7 s Apple A 6 and Power. VR SGX 543 MP 3 (3 -Core) GPU Memory: 1 GB DRAM The A 6 is said to use a 1. 3 GHz custom Apple-designed ARMv 7 based dual-core CPU, called Swift.
Objective-C is an object-oriented programming language used by Apple primarily for programming Mac OS X and i. OS 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 files
Classes The @interface Section @interface New. Class. Name: Parent. Class. Name { member. Declarations; } method. Declarations; @end Instance variables Class and instance methods
The @implementation Section @implementation New. Class. Name method. Definitions; @end The @class Section @class Classname; Used as forward declaration to reference another class defined in another file.
Example #import <Foundation/Foundation. h> @interface Fraction: NSObject { int numerator; int denominator; } -(void) print; -(void) set. Numerator: (int) n; -(void) set. Denominator: (int) d; @end
@implementation Fraction -(void) print { NSLog (@”%i/%i”, numerator, denominator); } -(void) set. Numerator: (int) n { numerator = n; } -(void) set. Denominator: (int) d { denominator = d; } @end
int main (int argc, char *argv[]) { @autoreleasepool{ Fraction *my. Fraction; // Create an instance of a Fraction my. Fraction = [Fraction alloc]; my. Fraction = [my. Fraction init]; [my. Fraction set. Numerator: 1]; [my. Fraction set. Denominator: 3]; NSLog (@”The value of my. Fraction is: ”); [my. Fraction 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;
Protocols A protocol declares methods that can be implemented by any class. @interface Myclass: NSObject <UIApplication. Delegate, Another. Protocol> {……. . } @end; Categories A 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
Environment To write an i. Phone application, you have to install Xcode and the i. Phone SDK. https: //developer. apple. com/xcode/
First i. Phone Application
Application Lifecycle
Responding to Interrupts
Moving from Foreground to Background
Moving from Background to Foreground
Publishing app to the App Store
Data Management SQLite 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 database Works 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.
Configuration Steps… Add the Framework for SQLite i. e. libsqlite 3. 0. dylib In xcode v 4+, select project then in project settings editor select summary. Scroll down to frameworks and select add (+). In the. h file #import “sqlite 3. h” Open connection with path and file. You can use any file format such as. db, . sql and. sqlite
SQLite Disadvantages Problem with foreign key Single user No procedures No security Problem with 64 bit system….
Table Views A table view is an instance of the UITable. View class in one of two basic styles, plain or grouped. Table views have many purposes: To let users navigate through hierarchically structured data To present an indexed list of items To display detail information and controls in visually distinct groupings To present a selectable list of options
Single View vs Table view bases Architecture main App Delegate View Controller Main Window View Controller Screen view View Controller 1 View Controller 3 View Controller 2 Main Window View Controller 1 Screen view View Controller 3 Screen view View Controller 2 Screen view
Steps Start a new project. Open Storyboard. Add three table view controllers (Tv. C 1, Tv. C 2, Tv. C 3) Add Navigation Controller: select Tv. C 1, Editor -> Embed in -> Navigation Controller. To connect, select Tv. C 1 drag Tv. C 1 cell to Tv. C 2 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 UITable. View. Controller. Link these classes to the views on storyboard. Add barbutton. Item to each view toolbar and link them to IBAction buttons in respective view. Controllers.
Segue
Link the two views using Segue. . Update methods: number. Of. Sections. In. Table. View Number. Of. Rows. In. Section cell. For. Row. At
Core Data A framework that supports creation of model objects that encapsulate your application data and logic in the Model-View. Controller design pattern. Built-in management of undo and redo beyond basic text editing. Automatic validation of property values. Maintaining the consistency of relationships among objects Grouping, filtering, and organizing data in memory and in the user interface Automatic support for storing objects in external data repositories https: //developer. apple. com/library/mac/#referencelibrary/Getting. Started. With. Core. Data/
Steps Create an empty Application * make sure “Use Core Data” is checked.
Manage object context: gateway into storing data objects. These data objects belong to the view content. Propagates all the changes to the file system Persistent 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/Data. Management/Co nceptual/i. Phone. Core. Data 01/Introduction. html#//apple_ref/doc/u id/TP 40008305 -CH 1 -SW 1
Core 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 Data Location: Coordinates (major property), Accuracy, Timestamps, etc. Placemark: An array of strings.
Conversion from Coordinates to Place Name Information
Conversion from Place Name Information to Coordinates
Gesture System Type Tapping Pinching in and out Panning or dragging Swiping Rotating Long press Custom Type http: //developer. apple. com/library/ios/#documentation/Event. Handling/Conceptual/Event. Handlingi. Phone. OS/Gesture. Recognizer_basics tml
Mechanism of gesture http: //developer. apple. com/library/ios/#documentation/Event. Handling/Conceptual/Event. Handlingi. Phone. OS/Gesture. Recognizer_basics/Gesture. Recognizer_ba tml
Discrete Gesture http: //developer. apple. com/library/ios/#documentation/Event. Handling/Conceptual/Event. Handlingi. Phone. OS/Gesture. Recognizer_basics/Gesture. Recognizer_ba tml
Continuous Gesture http: //developer. apple. com/library/ios/#documentation/Event. Handling/Conceptual/Event. Handlingi. Phone. OS/Gesture. Recognizer_basics/Gesture. Recognizer_ba tml
Add a built-in gesture recognizer to your app Create 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/Event. Handling/Conceptual/Event. Handlingi. Phone. OS/Gesture. Recognizer_basics/Gesture. Recognizer_ba tml
Jailbreak History Major Players Reasons To Jailbreak it Techniques Kernel Debugging The Current Jailbreak Links
History
Major Players
Reasons To Break it
Terms KDP XNU RWX ROP Stack Buffer Overflows Heap Buffer Overflows HFS
Techniques Kernel Debugging
Kernel Debugging - Tools - Stack Buffer Overflow - Heap Buffer Overflow
The Current JB
References [1] Objective-c reference, http: //developer. apple. com/library/mac/#referencelibrary/Getting. Started/Learning_Objective. C_A_Primer/_index. html#//apple_ref/doc/uid/TP 40007594 Programming in Objective-C 2. 0 by Stephen G. Kochan Xcode user guide link, http: //developer. apple. com/library/mac/#documentation/Tools. Languages/Conceptual/Xcode 4 Us er. Guide/000 -About_Xcode/about. html#//apple_ref/doc/uid/TP 40010215 Developing i. OS app, https: //developer. apple. com/library/ios/#referencelibrary/Getting. Started/Road. Mapi. OS/chapters/I ntroduction. html i. OS development center, developer. apple. com https: //developer. apple. com/library/ios/#documentation/User. Experience/Conceptual/Table. View_i Phone/About. Table. Viewsi. Phone. html#//apple_ref/doc/uid/TP 40007451 CH 1 -SW 1 http: //media. blackhat. com/bh-us 11/Esser/BH_US_11_Esser_Exploiting_The_i. OS_Kernel_Slides. pdf http: //antid 0 te. com/CSW 2012_Stefan. Esser_i. OS 5_An_Exploitation_Nightmare_FINAL. pdf http: //developer. apple. com/library/ios/#documentation/Event. Handling/Conceptual/Event. Handling i. Phone. OS/Gesture. Recognizer_basics. htm Apple Document “Location Awareness Programming Guide” Book “Beginning. i. OS 5. Development” by Dave Mark, Jack Nutting, Jeff La. Marche Harvard Extension School: http: //cs 76. tv/2012/spring/#l=lectures&r=about&v=lectures/9/lecture 9 https: //developer. apple. com/library/mac/#documentation/Cocoa/Conceptual/Core. Data/cd. Progra mming. Guide. html#//apple_ref/doc/uid/TP 30001200 -SW 1
- Slides: 72