Team Members Purva Ajit Huilgol Shruthi Sambasivan Shivani Nayar

Team Members
Purva Ajit Huilgol
Shruthi Sambasivan
Shivani Nayar
Xidong Wang
Shawn Pike
Overview
 Introduction to iOS

 History
 Architecture
 Platform








Introduction to Objective-C
Development environment and Application lifecycle.
HelloWorld! App
TableViews
SQLite and Code Data
Webservices
Location services and Gestures
Jailbreak
Introduction to iOS
The Beginnings





Apple's Steve Jobs introduced the iPhone to the
world on January 10th, 2007
iOS actually began life with a different name: OS X
When 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 born

 Windows 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 support









3G
multitasking
3rd 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.
iOS 1: The iPhone is born

 Few of the many innovations were revolutionary for
the mobile industry.
 The core iOS user interface.
 Mobile Safari web browser
 Google Maps
 Visual voicemail
 The software keyboard
iOS 1: The iPhone is
born

Some specific iOS updates
Version
Year
Devices
Features
iOS 1.1
Released
09 /2007
iPhone 2G,
iPod Touch 1st
Gen
• iTunes Wi-Fi Music
Store,
• iPod Touch
compatibility
iOS 2.0
Released
07 / 2008
iPhone 3G & 2G,
iPod Touch 1st
Gen
• Native 3rd-party apps,
• App Store
• Microsoft Exchange
support
• MobileMe
• Contact Search
iOS 2.0

Version
Year
Devices
Features
iOS 2.1
Released
09 / 2008
iPhone 3G and 2G
iPod Touch 2nd
Gen & 1st Gen
Battery life and speed
fixes
iTunes Genius playlists
Dropped call fixes
iOS 2.2
Released
11 / 2008
iPhone 3G and 2G
iPod Touch 2nd
Gen and 1st Gen
Google street view
Podcast downloads
iOS 3.0

Version
Year
Devices
Features
• Cut, copy, paste
• Voice Control
• MMS
• Spotlight search
• Push notifications
• USB & Bluetooth tethering
• Landscape keyboard
• Find my iPhone
iOS 3.0
Released
06 / 2009
iPhone 3GS, 3G & 2G
iPod Touch 2nd Gen
&
1st Gen
iOS 3.1
Released
09 / 2009
iPhone 3GS, 3G & 2G • Genius features
iPod Touch 3rd Gen, • Ringtone downloads
2nd Gen and 1st Gen* • Remote lock
• Voice Control over
Bluetooth
iOS 3.2 : The iPad 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
iOS 4.0 : Multitasking

Version
iOS 4.0
Year
Released
06 / 2010
Devices
iPhone 4,
iPhone 3GS,
iPhone 3G*,
iPod Touch 3rd Gen,
iPod Touch 2nd Gen
Features
• Multitasking
• Home screen folders
• FaceTime video chat
• Unified email inbox
• Threaded email
messages
• Retina Display
support
• iAd support
Version
iOS 4.0 Updates

Year
Devices
Features
iOS 4.1
Released
09 / 2010
iPhone 4, 3GS & 3G
iPod Touch 4th Gen,
3rd Gen & 2nd Gen
Game Center
TV rentals
iTunes Ping
HDR photos
iOS 4.2.1
Released
11 / 2010
iPhone 4, 3GS and 3G
iPad
iPod Touch 4th Gen,
3rd Gen and 2nd Gen
iPad multitasking
iPad folders
AirPlay
AirPrint
iOS 4.2.5
Released
02 / 2011
Verizon iPhone 4
Verizon support
Personal hotspot (CDMA)
iOS 4.3
Released
03 / 2011
iPhone 4 (GSM),3GS,
iPad 1 & 2
iPod Touch 4th Gen &
3rd Gen
Personal Hotspot (GSM)
AirPlay for 3rd-party
apps
iTunes Home Sharing
iOS 5.0: Siri & Much
More…








Siri
Notification Center
iMessage
No PC required
iTunes Wi-Fi Sync
Over-the-air updates
iCloud
iOS 6 : Goodbye to Google
Maps









Maps
Siri enhancements
Notification Center.
Facebook integration
Passbook
Shared Photo Streams
iCloud Tabs and Reading List enhancements
FaceTime over cellular and better Apple ID integration
iOS : 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 iPhone app
development:
 UI Kit Framework
 Map Kit Framework
 Push Notification Service
 Message UI Framework
 Address UI Framework
 Game Kit UI Framework
 iAd 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 iPhone address book
from the application.
Other Frameworks

 iAd 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 iPhone5

Processor: 1.3 GHz Dual Core Apple-designed ARMv7s
Apple A6 and
PowerVR SGX543MP3 (3-Core) GPU
Memory: 1GB DRAM
The A6 is said to use a 1.3 GHz custom Apple-designed
ARMv7 based dual-core CPU, called Swift.
Objective-C

 Objective-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 files
Classes
The @interface Section
@interface NewClassName: ParentClassName
{
memberDeclarations;
}
methodDeclarations;
@end
Instance variables
Class and instance methods
The @implementation Section
@implementation NewClassName
methodDefinitions;
@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) setNumerator: (int) n;
-(void) setDenominator: (int) d;
@end
@implementation Fraction
-(void) print
{
NSLog (@”%i/%i”, numerator, denominator);
}
-(void) setNumerator: (int) n
{
numerator = n;
}
-(void) setDenominator: (int) d
{
denominator = d;
}
@end
int main (int argc, char *argv[])
{
@autoreleasepool{
Fraction *myFraction; // Create an instance of a
Fraction
myFraction = [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;
Protocols
A protocol declares methods that can be implemented by
any class.
@interface Myclass:NSObject
<UIApplicationDelegate, AnotherProtocol>
{……..}
@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 iPhone
application, you have
to install Xcode and
the iPhone SDK.
https://developer.app
le.com/xcode/
First iPhone 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.
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

SQLite Disadvantages






Problem with foreign key
Single user
No procedures
No security
Problem with 64bit system….
Table Views
 A 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 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
main
App Delegate
View Controller
Main Window
View Controller
Screen view
View
Controller1
View
Controller3
View
Controller2
Main Window
View Controller1
Screen view
View Controller3
Screen view
View Controller2
Screen view
Steps
 Start 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.
Segue

 Link the two views using Segue..
 Update methods:
 numberOfSectionsInTableView
 NumberOfRowsInSection
 cellForRowAt
Core Data
A framework that supports creation of model objects that
encapsulate your application data and logic in the Model-ViewController 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/GettingStarted/GettingStartedWithCoreData/
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/DataManageme
nt/Conceptual/iPhoneCoreData01/Introduction/Introduction.html#//app
le_ref/doc/uid/TP40008305-CH1-SW1
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/EventHandling/Conceptual/EventHandlingiPhoneOS/GestureRecognizer_basics/GestureRecognize
_basics.html
Mechanism of gesture

http://developer.apple.com/library/ios/#documentation/EventHandling/Conceptual/EventHandlingiPhoneOS/GestureRecognizer_basics/GestureRecog
_basics.html
Discrete Gesture

http://developer.apple.com/library/ios/#documentation/EventHandling/Conceptual/EventHandlingiPhoneOS/GestureRecognizer_basics/GestureRecog
_basics.html
Continuous Gesture

http://developer.apple.com/library/ios/#documentation/EventHandling/Conceptual/EventHandlingiPhoneOS/GestureRecognizer_basics/GestureRecog
_basics.html
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/EventHandling/Conceptual/EventHandlingiPhoneOS/GestureRecognizer_basics/GestureRecog
_basics.html
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/GettingStarted/Learning_Objectiv
e-C_A_Primer/_index.html#//apple_ref/doc/uid/TP40007594
 Programming in Objective-C 2.0 by Stephen G. Kochan
 Xcode user guide link,
http://developer.apple.com/library/mac/#documentation/ToolsLanguages/Conceptual/Xco
de4UserGuide/000-About_Xcode/about.html#//apple_ref/doc/uid/TP40010215
 Developing iOS app,
https://developer.apple.com/library/ios/#referencelibrary/GettingStarted/RoadMapiOS/chapters/Introduct
ion.html
 iOS development center, developer.apple.com
 https://developer.apple.com/library/ios/#documentation/UserExperience/Conceptual/TableView_iPhone/
AboutTableViewsiPhone/AboutTableViewsiPhone.html#//apple_ref/doc/uid/TP40007451-CH1-SW1
 http://media.blackhat.com/bh-us11/Esser/BH_US_11_Esser_Exploiting_The_iOS_Kernel_Slides.pdf
 http://antid0te.com/CSW2012_StefanEsser_iOS5_An_Exploitation_Nightmare_FINAL.pdf
 http://developer.apple.com/library/ios/#documentation/EventHandling/Conceptual/Event
HandlingiPhoneOS/GestureRecognizer_basics/GestureRecognizer_basics.htm
 Apple Document “Location Awareness Programming Guide”
 Book “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/lecture9
 https://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/CoreData/cd
ProgrammingGuide.html#//apple_ref/doc/uid/TP30001200-SW1