My First iPhone App Dr. Luis Weruaga
What is the iPhone?
CPU 1-GHz GPU 512 MB 32 GB 960 x 640 WiFi/3G GPS touchscreen 2 cameras accelerometer compass gyroscope bluetooth
multitask ...
2
Applications • Audio & Video • Mathematical Computation • Data Management • Graphics & Animation • Networking & Internet • Security • User Interface 3
iPhone Programming To get started you just need one of these ...
4
Starting Kit iMac
+ 5
• XCode
App development environment.
• Interface Builder
Graphical tool for GUI development.
• iPhone Simulator
Run Apps in the Mac.
• Instruments
Measure the App performance. 6
XCode Software development environment for the iPhone, for the Mac, for Mac OS ...
7
• It is Apple’s programming language, for iPhone & Mac. • Objective-C is a superset of GNU C/C++. • XCode understands and compiles C/C++ code. • iPhone APIs are invoked with Objective-C code. • However C++ can be used anywhere in your project. • Objective-C gets closer to “natural language” programming: intuitive and easy-to-read.
8
More on • Objective-C is strongly influenced by • Smalltalk was created to underpin the “new world” of
computing exemplified by “human–computer symbiosis.” [object method1:parm1 method2:parm2 ...]
• Some actual examples of Objective-C code: UIView* myView = [[UIView alloc] initWithFrame:[UIScreen mainScreen]]; [NSThread detachNewThreadSelector:@selector(myThreadCode) toTarget:self withObject:nil];
9
Static Analyzer • Tool in XCode for finding potential bugs without running the executable.
10
Development Tools • XCode
App development environment.
• Interface Builder
Graphical tool for GUI development.
• iPhone Simulator
Run Apps in the Mac.
• Instruments
Measure the App performance. 11
iPhone Simulator • It runs iPhone/iPad Apps on the Mac. • For testing and validating the outcome of the App.
12
Development Tools • XCode
App development environment.
• Interface Builder
Graphical tool for GUI development.
• iPhone Simulator
Run Apps in the Mac.
• Instruments
Measure the App performance. 13
Instruments
14
Development Tools • XCode
App development environment.
$0
• Interface Builder
Graphical tool for GUI development.
• iPhone Simulator
Run Apps in the Mac.
• Instruments
Measure the App performance. 15
Testing the Project
Simulator
Device the Project
XCode 16
Installing App in Device
17
iPhone University Program • Student Development Team. Up to 200 students.
$0
• Development Resources iPhone Dev Center.
• Test on iPhone, iPad, & iPod Touch
Install applications directly on the real devices.
• Sharing applications
Allows students and professors within the same team to share their applications.
http://developer.apple.com/programs/iphone/university/ 18
Developer Programs
19
Some Useful Links • Stanford’s iPhone Competition.
http://studentapps.stanford.edu/
• iPhone Developer University Program.
http://developer.apple.com/programs/iphone/university/
• MacLab Program
http://www.apple.com/education/maclabs/
• iPhone Developer Program
http://developer.apple.com/iphone/index.action 20
iPhone OS (iOS) architecture 1. Core OS—This level contains the kernel, the file system, networking infrastructure, security, power management, and device drivers. It also the POSIX/BSD 4.4/C99 API specifications and includes system-level APIs. 2. Core Services—The frameworks in this layer provide core services, such as string manipulation, data management, networking, URL utilities, contact management, and preferences. This layer includes Core Foundation, which provides abstractions for common data types (such as strings and collections). 3. Media—The frameworks and services provide graphical and multimedia services to the Cocoa Touch layer. They include Core Graphics, OpenGL ES, Core Animation, Core Audio, and video playback. 4. Cocoa Touch—The frameworks in this layer directly support applications based on iOS. They include several Objective-C frameworks that are particularly important for developing applications for iOS.
21
iOS Frameworks 1
2
3
4
22
23
Hands-On
24
“Hello World” App iOS UIApplicationDelegate
UIViewController
UITextField
UILabel
25