720 likes | 830 Views
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
E N D
Native iOS Application DevelopmentCST 594 – Mobile Computing Team Members PurvaAjitHuilgol ShruthiSambasivan 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 iOSThe 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
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 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
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.
Environment To write an iPhone application, you have to install Xcode and the iPhone SDK. https://developer.apple.com/xcode/
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, .sqland .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 Controller1 View Controller3 View Controller View Controller2 MainWindow MainWindow View Controller3 Screen view View Controller Screen view View Controller1 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.
Link the two views using Segue.. • Update methods: • numberOfSectionsInTableView • NumberOfRowsInSection • cellForRowAt
Core DataA 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/GettingStarted/GettingStartedWithCoreData/
Steps • Create an empty Application • * make sure “Use Core Data” is checked.