Você está na página 1de 22

iPhone Research Paper

MAD Intensive Programme 2009

Nick Van Elslander


Artesis Hogeschool Antwerpen

Mario Suppan
FH Joanneum

Thomas De Roy
Haute École Provinciale de Mons-Borinage-Centre

Tuan Vu
Central Ostrobothnia

Roland Rzepecki
Wysza Szkola Informatyki

Marlon Ayres
Escola Superior de Comunicação Social
Inhoudsopgave

1 Introduction........................................................................................................................................................ 3

2 Platform ................................................................................................................................................................ 4
2.1 Hardware ..................................................................................................................................................... 4
2.2 Operating System ..................................................................................................................................... 5
2.3 Network Connectivity ............................................................................................................................. 8
2.4 Security ......................................................................................................................................................... 9
2.5 Performance ............................................................................................................................................. 10
2.6 Future Possibilities ................................................................................................................................. 13

3 Software Development ................................................................................................................................ 14


3.1 Development Requirements .............................................................................................................. 14
3.2 IDE and Tools ............................................................................................................................................ 15
3.3 Programming Languages .................................................................................................................... 16

4 Overall Evaluation .......................................................................................................................................... 22


4.1 Advantages ............................................................................................................................................... 22
4.2 Limitations................................................................................................................................................. 22
4.3 Conclusion................................................................................................................................................. 22


 
1. Introduction
Currently, Apple’s iPhone is the yearning of the modern man. Top-notch product design,
an intuitive user-interface as well as fancy multimedia internet based services may
contribute to its unique market position. Therefore, if not yet accomplished, many
software developers are considering getting into the iPhone platform ASAP, serving the
market. But still: What is it that makes the iPhone better than other smartphones? On the
other hand, aren’t there any weaknesses that could impede development projects? If so,
which ones exactly and why?

The general aim of this report is to provide a comprehensive review and a critical
evaluation of Apple’s iPhone platform from a software developer point of view. Readers
are introduced to all core platform features as well as to the device’s set-up for software
development projects. By bringing the iPhone’s advantages and limitations together,
readers shall finally be empowered to decide on whether and why to invest in future
projects targeting the iPhone market segment or better stick with alternative platforms.

Next, some general information on the iPhone will be elaborated. More precisely, historical
data on Apple’s efforts for the development and improvement of the device is delivered.


 
2. Platform
2.1. Hardware
Up to now, Apple has released two versions of the iPhone. The first was initially introduced
to the public on January 9, 2007. Its successor, the iPhone3G was revealed on July 11, 2008.
Referring to Apple (2009d) the iPhone3G has the following hardware specifications:
• Device dimensions/weight: 4.5 x 2.4 x 0.48 inch / 4.7 ounces
• Display size: 3.5 inch
• Resolution: 480 x 320 pixel at 163 ppi (i. e. aspect ratio 3:2)
• Storage: 8 or 16 GB NAND flash drive
• Power supply via built-in rechargeable lithium-ion battery:
– Standby time up to 300 hours
– Talk time up to 5 hours on 3G or up to 10 hours on 2G
– Internet use up to 5 hours on 3G or up to 6 hours on Wi-Fi
– Video playback up to 7 hours
– Audio playback up to 24 hours
• Network capabilities:
– 802.11b/g Wi-Fi
– Bluetooth 2.0 + EDR
– UMTS/HSDPA: 850, 1900, 2100 MHz
– Quad band GSM / EDGE: 850, 900, 1800, 1900 MHz
• Sensors: accelerometer, proximity sensor, ambient light sensor
• Input devices: Multi-touch enabled screen interface plus 4 buttons (”Home”,
”Sleep/Wake”, ”Volume up/down”, ”Ring/silent”)
• Camera with 2 megapixel
• Connectors and input/output: 30-pin dock connector, 3.5mm stereo headphone
minijack, SIM-card tray, built-in speaker or headphone (frequency response 20 -
20,000 Hz), microphone
• GPS unit supporting Assisted GPS (i. e. location detection by registering cell phone
towers and Wi-Fi stations)
Paradoxically, Apple maintains a low profile on the iPhone’s processor and working
memory properties. Yet, as various web resources claim (e.g., Patterson, 2008; Mannion,
2007), the device is run by a Samsung ARM1176JZ(F)-S v1.0 CPU with 620 MHz
underclocked to 412 MHz, which actually is a 32-bit RISC processor. Memory is reported to
be 128 MB DRAM (SemiconductorInsights, 2008).


 
2.2. Operating System(s)
The iPhone is one of the few devices that has its very own operating system. This means
that there is a maximization of the software-hardware compatibility.
To create the most secure and efficient structure in the iOS (short for iPhone Operating
System), the first developers decided to divide it in 4 layers that communicate only with
the layer above and/or beneath it. This way for instance, they can make sure that the
deepest layer, the “Core Layer”, cannot be changed by any event in the 2 upper layers.

The 4 layers of the iOS:

1) Cocoa Touch Layer (upper layer)


This layer is very important for application developers, because it contains the key
frameworks that provide the infrastructure you need to implement applications. It is
vital to try and build your application only with the functions available in this layer. The
most used frameworks are the “UIKit Framework”, mainly used for the implementation
of the graphical user interface, and the “Foundation Framework”, mainly used to
communicate with the “Core Foundation Framework” in the lower Core Services Layer,
which contains all the other available development features.

2) Media Layer
When you develop a program that will need multimedia services, you have to address
this layer. It contains all the graphics, audio and video technologies which will make it
easier for you to build applications that look and sound great.
The Core Graphics framework (CoreGraphics.framework) contains the interfaces for
the Quartz 2D drawing API. Quartz is the same advanced, vector-based drawing engine
that is used in Mac OS X. It provides support for path-based drawing, anti-aliased
rendering, gradients, images, colors, coordinate-space transformations, and PDF
document creation, display, and parsing. Although the API is C based, it uses object-
based abstractions to represent fundamental drawing objects, making it easy to store
and reuse your graphics content.
The Quartz Core framework (QuartzCore.framework) contains the Core Animation
interfaces. Core Animation is an advanced animation and compositing technology that
uses an optimized rendering path to implement complex animations and visual effects.
It provides a high-level, Objective-C interface for
configuring animations and effects that are then rendered in hardware for performance.
Core Animation is integrated into many parts of iPhone OS, including UIKit classes such
as UIView, providing animations for many standard system behaviors. You can also use
the Objective-C interface in this framework to create custom animations.
The audio technologies available in iPhone OS are designed to help you provide a rich
audio experience for your users. This includes the ability to play back or record high-
quality audio and the ability to trigger the vibration feature on devices that support
those capabilities.


 
The audio technologies in iPhone OS support the following audio formats:
• AAC
• Apple Lossless (ALAC)
• A-law
• IMA/ADPCM (IMA4)
• Linear PCM
• μ-law
Concerning the video technologies, iPhone OS provides support for full-screen video
playback through the Media Player framework (MediaPlayer.framework). This
framework supports the playback of movie files with the .mov, .mp4, .m4v, and .3gp
filename extensions and using the following compression standards:
• H.264 Baseline Profile Level 3.0 video, up to 640 x 480 at 30 fps. Note that B
frames are not supported in the Baseline profile.
• MPEG-4 Part 2 video (Simple Profile)
• Numerous audio formats, including the ones listed in “Audio Technologies”
3) Core Services Layer
Core Services is the layer that provides the fundamental system services that all
applications use. Even if you do not use these services directly, know that every
technology in the system is built on top of them.
There are many frameworks (Address Book, SQLLite …) located in this layer, including
the following, some of the most important ones.

Core Foundation

The Core Foundation framework (CoreFoundation.framework) is a set of C-based


interfaces that provide basic data management and service features for iPhone
applications. It is closely related to the Foundation framework, which provides
Objective-C interfaces for the same basic features. When you need to mix Foundation
objects and Core Foundation types, you can take advantage of the “toll-free bridging”
that exists between the two frameworks. Toll-free bridging means that you can use
some Core Foundation and Foundation types interchangeably in the methods and
functions of either framework. This support is available for many of the data types,
including the collection and string data types. The class and type descriptions for each
framework state whether an object is toll-free bridged and, if so, what object it is
bridged with.

CFNetwork

The CFNetwork framework (CFNetwork.framework) is a set of high-performance, C-


based interfaces that provide object-oriented abstractions for working with network
protocols. These abstractions give you detailed control over the protocol stack and
make it easy to use lower-level constructs such as BSD sockets. You can use this
framework to simplify tasks such as communicating with FTP and HTTP servers or
resolving DNS hosts.


 
Security

In addition to its built-in security features, iPhone OS also provides an explicit Security
framework (Security.framework) that you can use to guarantee the security of the data
your application manages. This framework provides interfaces for managing certificates,
public and private keys, and trust policies. It supports the generation of
cryptographically secure pseudo random numbers. It also supports the storage of
certificates and cryptographic keys in the keychain, which is a secure repository for
sensitive user data.
The CommonCrypto interfaces provide additional support for symmetric encryption,
HMAC, and Digests. The Digests feature provides functions that are essentially
compatible with the functionality normally found in the OpenSSL library, which is not
available in iPhone OS.

XML Support

The Foundation framework provides the NSXMLParser class for retrieving elements
from an XML document. Additional support for manipulating XML content is provided
by the libXML2 libraries. This open source library lets you parse or write arbitrary XML
data quickly and transform XML content to HTML.

4) Core OS Layer (deepest layer)


Core OS is the layer that encompasses the kernel environment, drivers, and basic
interfaces of the operating system. The kernel itself is based on Mach and is responsible
for every aspect of the operating system. It manages the virtual memory system,
threads, file system, network, and interprocess communication. The drivers at this layer
also provide the interface between the available hardware and system frameworks.
However, access to the kernel and drivers is restricted to a limited set of system
frameworks and applications for security purposes.
iPhone OS provides a set of interfaces for accessing many low-level features of the
operating system. Your application accesses these features through the LibSystem
library.


 
2.3. Network Connectivity
Tech Specs
• UMTS/HSDPA (850, 1900, 2100 MHz)
• GSM/EDGE (850, 900, 1800, 1900 MHz)
• Wi-Fi (802.11b/g)
• Bluetooth 2.0 + DER

Networking capabilities

To register a network service or to discover a network service without much programming


effort, Bonjour, Apple’s so called zero-configuration network technology, can be utilized
(Apple, 2009c). When implementing Bonjour on the iPhone, spontaneous connections to
IP-networks can be established and provided services can be recognized among members
(printers, files, contacts, etc.). Therefore, no network configuration is needed at all.
Beyond Bonjour utilization iPhoneOS networking code can be written either in C or in
Objective-C, which means that developers may choose the language they are more
familiar with. Moreover, porting code from other platforms is facilitated. Depending on the
needs of single applications, developers can work with sockets directly or use an
abstraction layer that already delivers pre-defined functions.
iPhoneOS provides several frameworks and libraries that can be used for networking and
internet-based features with the iPhone device (Apple, 2009a):
• CoreFoundation Framework
System-independent methods for creating, reading, updating, or deleting single
URL resources
• CFNetwork (C based)
Various network tasks, like working with BSD sockets, communication with HTTP
and FTP servers (e.g. GET, POST,FTP Directory read,…), Bonjour services
management
• CFNetServices (C based)
Discovery or Registration of network services like printers or file servers
• Foundation Framework (Objective-C based)
Contains object-oriented abstractions for various CFNetwork APIs
• BSD networking APIs (C based)
Provision of low-level networking functions that are not covered in other
classes/frameworks


 
Networking, i.e. transmitting or receiving data via network, is among the most power-
intensive operations on any device. Therefore, it is important to minimize processor-time
for such tasks in order to improve battery life. To achieve this, iPhone developers ought to
take the following tips into account (Apple, 2009a):
• Data formats need to be defined as compact as possible.
• Communication using “chatty” protocols has to be avoided.
• Data Packet Transmission should occur in bursts whenever possible.

Any application that needs Wi-Fi connection must inform the system on that requirement
in its Info.plist property file. Although iPhoneOS implements shutdown of Wi-Fi radio after
30 minutes of inactivity, it is possible to disable this feature by including the
UIRequiresPersistentWiFi key in the above mentioned property file. By setting the value to
TRUE the timer is disabled as long as the application is running. Also, the system then
knows that the network selection panel has to be displayed if any active Wi-Fi hot spot is
detected (Apple, 2009a).

2.4. Security
Root-Access disabled

Users and applications cannot perform operations that require root or administrative
access (Mark & LaMarche, 2009).
Keychain

Confidential data like passwords, encryption keys, and certificates are securely stored in
a dedicated repository (Apple, 2008a).
Application Sandbox

Unlike desktop applications iPhone applications only have widely restricted access to the
file system. Files (preferences, documents,…) can only be read and written to the particular
portion of the file system where the application is installed. Furthermore, the application
can also see its own keychain items. This is called the application’s sandbox (Mark &
LaMarche, 2009, Apple, 2008a).
Secure network connections

Push email, contacts, calendar and any other network connections may be secured via 128-
bit SSL or TLS. (Apple, 2008a; 2008b).


 
Certificates and identities

With SSL, iPhone supports 128-bit encryption and X.509 root certificates issued by the
major certificate authorities. iPhone also supports strong authentication methods,
including industry-standard MD5 Challenge-Response and NTLMv2 (Apple, 2008b).
Authentication mechanisms

iPhoneOS provides WEP, WPA, and also WPA2 128-bit AES encryption for the highest level
of wireless access security. Also, iPhones can be integrated into numerous RADIUS
authentication environments that support EAP-TLS, EAP-TTLS, EAP-FAST, PEAPv0, PEAPv1,
and LEAP authentication (Apple, 2008b).
VPN support

iPhoneOS supports Cisco IPSec, L2TP over IPSec, and PPTP VPN protocols. For VPN
Authentication numerous methods exist, e.g. basic username and password via MS-
CHAPv2, RSA SecurID, CRYPTOCard, Certificates (PKCS1, PKCS12), and shared secret
authentication (Apple, 2008a).
Remote wipe

When the iPhone device is lost or stolen, administrators are capable of deleting its
contents remotely (Apple, 2008a)
Enforced security and password policies

The minimum number of characters, number of complex characters required, passcode


expiration, device lock interval, and maximum failed attempts can be configured (Apple,
2008a).
iPhone OS security features are implemented at the Core OS level and its security APIs are
at the Core Services level in the system architecture.

10 
 
2.5. Performance
User Experience - “I bought an iPhone, now what?”

Design Concept

As it is traditional of Apple to bring innovation to the market, the iPhone was no different.
The common mobile phone concept completely changed when Apple showed their vision,
a phone in which calling would be the last thing to be noticed.
Based on user-centered design, intuitive and simple while heavily functional, they
presented a thin and light-weight mobile phone that was 100% touch operated, which
made all the difference, especially because of its User Interface: your finger would be the
new concept of a pointer.
Having a larger pointer meant that common screen sizes on the market wouldn’t work
anymore and a larger one was needed, as well as a complete rearrangement of buttons
and information in general, a design mostly focused on operational needs rather than
graphical appeal. As many people wouldn’t say: that was the trick for the iPhone.

“Tap Away”

How could you be aesthetically pleasing through functional concerns only? When the
buttons are the center piece of design how can you maintain visual cleanliness and
simpleness and still hit the usual hype which Apple’s products are so well known for.
At last the iPhone had to be innovative, and what better way to achieve that than by
rethinking the whole concept of mobile screen design: conquer the costumer by looks and
also by feel.
Users are the most important thing for Apple, hence why they released a set of guidelines
about design for developers.
As stated, the so called “Human Interface”(HI) is the new term for User Interface(UI): design
for the fingers, while relying upon the definition of your target audience. While designing,
you should find the fastest, smartest and easiest way to get things done, avoiding clutter
as most as you can. Think over your user needs first, and how he will work with your
application on a daily basis. Having these key points in mind should get you to your final
design with no trouble. Don’t waste your time giving many functions to the user, just give
what he needs to get to his goal. If you achieve that, you have a true iPhone app.

As for the OS itself, after starting the phone you get a grid-like home screen, where each
icon is a different application, each one with a very different purpose. To start an app it is
as easy as tapping on it, as well as quitting it by clicking the physical button on the lower
part of the phone. After filling out your screen with 16 icons you get another “page” of free
space for more and so on, meaning that it features a virtually wider screen space than
normal mobile screens, accessible via implemented “gestures”, just like the ones from
Mac’s “Trackpad”(mousepad).

11 
 
Mobile Entertainment Center: bring back the “smartness” to the smart-phone

Besides being pretty and well designed, iPhone is much more than a calling device. It
gained its place not just for beauty but specially for function. The purpose of Apple was to
bring the meaning of “smartphone” back to the normal user, so he could do more than just
calling: it should be the new “meeting point” for the personal tasks, just what the
computer or the living room is today. To reach that goal first you should feel like home,
where you have everything you know and are used to work with.
In that way, the first apps on the phone were the most common and well known apps from
the Mac, as well as the most basic functions for a smartphone: iTunes, Safari, Mail,
Calendar, Agenda, Youtube, Camera, etc, making it as easy an accessible as it could be for
the common user, so he would no longer have the excuse for not doing complex tasks.
As short as it took for people to get used to the iPhone, it naturally gained presence and
hype right from the release, almost setting a new standard for innovation as well as for the
new mobile way of living.
In this matter, price wouldn’t be a problem, because as expensive as it was for the normal
phone, it wasn’t to much for something that was unique and so much different from
everything else, it felt right to pay more than usual to have the state-of-the-art in mobile
design and technology.
No one was expecting this kind of approach from Apple to the mobile market, and that
was a big help to make it one of the biggest announcements of the company.

Touch Generation:

We could say Apple’s iPhone began a new generation of mobile interactivity. Before Touch
people only knew the concept of D-Pad, a 4-way directional interface which was the only
way to get to the end of each task, working within a button-based physical interface , that
together with the keypad took considerable space over the screen size on the final layout
of the phone. With touch people could have the screen and the interface all together on
the same space, besides not having to be locked on to a 4-way D-Pad anymore or to make
a point-to-point navigation on the OS.
Competition wouldn’t take much time to react to this new approach to the mobile phone.
Soon, many brands like HTC, Samsung, LG, Blackberry, SonyEricsson and even Nokia
started taking advantage from touch featured devices, so they could face Apple’s growing
popularity as well as market share, the touch generation of the mobile phones was born.
Models like HTC Touch, Nokia 8500 ExpressMusic, Sony Ericsson W960, Blackberry Pearl, LG
LGKS20 started to appear on the market, each one with very different ways for using touch
capability and so enlarging the wideness of choice for consumers and almost creating a
new class of products that would be the people’s new concept of innovation: “the touch
generation”.

12 
 
Gaming on the iPhone

Right from the start, the iPhone was a hugely promising platform, but not just for general
applications, it was specially good for building new ways of playing games. With the most
innovative technology yet on market, you had many different kinds of devices installed on
a single mobile phone, so you can use them on the development of truly unique games.
That was one of the key aspects of the iPhone: OpenGL powered graphics, touch interface,
as well as multiple sensors like accelerometer, light sensor and proximity sensor , which
were all available to be used, and it rapidly shown how it could get to be a very profitable
gaming platform.
As the iPhone OS 2.0 unveiled on June 11th 2008 it came with direct access to the App
Store, a new service launched the day before, which already came with more than 200
applications for instant download. This new service made the development workflow
much easier, as well as it did for the consumer and for the iPhone’s marketing in general.
As it was done for general applications, gaming took advantage of that medium to raise
the iPhone to the status of raising new portable gaming platform too, competing with
other established ones like Nintendo DS or Sony PSP.
Today, iPhone is known for its innovative play found in titles like Super Monkey Ball, where
you have to control the stability of the phone to guide your character’s ball to the end of
the course. The accelerometer is used for this controls, as well as most driving and
balancing games started to be.
Touch began to be interesting also to making music, and for that purpose instrument
“emulators” were released: Pianist for playing piano, BeatMaker for drum arrangements,
and much more, Drummer, Guitarist, Ocarina, etc. Having these applications installed
made the iPhone mean much more than a just mobile phone, it gave people the freedom
to be creative and make their own music.
This happened not just for consumers but also for publishers. The new technological and
interactive way of making music also appealed the music market, that is the reason why
companies such as Moo Cow Music or Smule were created, to have their business pointed
exclusively for the iPhone market. As for general gaming, as Ngmoco said: “We specifically
created our company to focus on the iPhone and iPod Touch. We have 14 games in
development right now”. Because of this kind of application bands like the iBand
appeared, showing how the power of many iPhones together could make real music
records. The App Store also attracted big publishing companies, as well as their big titles,
EA(Electronic Arts), iPlay, Gameloft, Digital Chocolate, Vivendi, Ngmoco, bring games like
Tetris, Fast and Furious, Asphalt 4, Brick Breaker Revolution, Crash Nitro Kart 3D, Rolando,
etc.

2.6. Future possibilities


Recently the App Store made available the Amazon Mobile, so people can shop “on the
go”. The App Store is continuously evolving and for that reason the “hot apps” are
changing constantly.
We can only estimate the future through the publishers expectations, in particular about
the launching of the iPhone OS 3.0, which promises to bring many new key features

13 
 
missed before: cut, copy and paste for example, as well as better support and integration
between the native set of applications and the hardware: Mail in widescreen for instance.
Discussions are taking place about what’s to come from Apple and the development of
their mobile phone, and specially what new “killer app” can be made for it. Companies are
specially interested on the gaming side of the platform: Unity Technologies responsible for
development of high-end 3D graphics for iPhone gathered with Garage Games, a 3D tools
developer; Pinch Media and GreyStripe from the business and publishing side, to discuss
the future of the platform at March 19th, 2009. A similar brainstorm was arranged earlier
on November 20th, 2008 by Apple itself, together with EA and the recent Ngmoco, to
showcase their upcoming titles as well as talk about ways to face other competing
portable game consoles. One idea is general, as Oliver (Ngmoco) stated about Super
Monkey Ball release: "it was very much an indication that [the platform] was viable", “a
posterchild of what's possible" said Borcher (Apple), in fact, for Borcher "things have gone
so much further than that".

3. Software Development
3.1. Development Requirements
There are 3 key components to be able to develop for the iPhone. The first is the
knowledge of the programmer, mainly focused on the programming languages. A decent
knowledge of objective-c, basic c++ and XML is needed to independently create a
standalone application for the iPhone. Luckily, these languages are well-known and you
can find many tutorial books about them.
The second component is a developer license. The iPhone OS is not open source, so as a
developer, you are obligated to purchase a license from Apple which allow you to legally
develop applications. There are 2 kinds of licenses, namely:
• The Standard Program, for an independent developer, which costs $99
• The Enterprise Program, for a business developing team, which costs $299
The last necessity for iPhone application development is the development software:
• the iPhone SDK, which contains the frameworks needed to successfully integrate
your application as an iPhone app
• an iPhone emulator, to test your application live
• XCode, the developing environment which has a customization module for iPhone
app development
• Cross Compiler: should you have programmed your application in a different
language than objective-c, you can sometimes find a cross compiler for it, which
will translate the binary code into objective-c binary code
When you acquire these 3 components, you will be set to start developing.

14 
 
3.2. IDE and Tools
With the tools included in the iPhone SDK, you can get started with the development of
your application for iPhone. To do that, you just have to access the iPhone Dev Centre to
gain a wealth of resources including videos, sample code, technical documentation,
Coding How-To's, and more.
Development Tools in the iPhone SDK:
Xcode: An integrated developing environment (IDE) that is provided by all of the
applications to develop and program. With this IDE we can create software in C or C++
with Carbon and Objective-C, AppleScript, Java with Cocoa. This programs can use all the
functionalities, the potency and the stability of MacOs and Unix. A complete development
environment provides a powerful source editor and a graphical debugger to the project
management.
IPhone Simulator: emulate an iPhone on your Mac. The iPhone simulator includes a
complete and conformant implementation of OpenGL ES 1.1 that you can use for your
application development. This implementation differs in a few ways from the
implementation found in iPhone OS–based devices. In particular, the simulator does not
have the same limitations regarding texture magnification filters or texture environment
operations that are described in “Hardware Capabilities.” In addition, the simulator
supports anti-aliased lines while iPhone OS–based devices do not.
There are some limitations of iPhone Simulator:
• Maximum of two fingers. If your application’s user interface can respond to touch
events involving more than two fingers, you can test that capability only on actual
devices.
• Accelerometer. Although you can access your computer’s accelerometer (if it has
one) through the UIKit framework, its readings will differ from the accelerometer
readings on a device. This discrepancy stems largely from the different positioning of
the screen in relation to the rest of the hardware between computers and iPhone
OS–based devices.
• OpenGL ES. OpenGL ES uses renderers on devices that are slightly different from
those it uses in iPhone Simulator. For this reason, a scene on the simulator and the
same scene on a device may not be identical at the pixel level.
Instruments: The Instruments application includes an OpenGL ES (Open Graphics Library
for Embedded System) instrument that you can use to gather information about the
runtime behaviour of your OpenGL code. In addition, you can set a breakpoint on see
when OpenGL errors are generated. The Instruments application provides an advanced
data gathering interface that lets you know exactly how your application uses resources,
such as the CPU, memory, file system, and so on. Instruments use software-based data-
gathering tools, known as instruments, to collect performance data. An instrument collects

15 
 
a specific type of data, such as network activity or memory usage. You find which
instruments are available for iPhone OS in the Instruments Library.
Interface Builder: Interface Builder is a graphical development environment integrally tied
into Xcode. Whenever you write an Xcode project, it includes a .xib file that contains
Interface Builder definitions where graphical objects are placed. Each of the different
Xcode templates come with different objects prebuilt this way. Some of them have
multiple, linked .xib files, with one file representing each separate screen of information.

3.3. Programming language(s)


Programming in Objective-C

The Objective-C language was implemented by B. J. Cox in the early 1980s. The language
was based on a language called SmallTalk-80 and was layered on top of the C language.
Extensions were added to C to create a new programming language that enabled objects
to be created and manipulated.
iPhone programming centers on two important paradigms: objected-oriented
programming and the Model-View-Controller (MVC) design pattern.

Programming syntax

Because of its origins, it is possible to compile C codes with an Objective-C compiler. Most
of its syntax, except the object oriented features which was inherited from Smalltalk, was
inherited from C language.

Preprocessor

The preprocessor, as in C language, is a part of the Objective-C compilation process that


recognizes special statements that can be interspersed throughout a program before the
actual code is analyzed. Preprocessor provides the tool to develop programs that are easier
to distribute to different systems, possible to suit some particular programming
applications or programming styles.
There are couples of preprocessors, which are all begin by sharp sign (#), as #define, #undef,
#ifdef, #ifndef, #else and #endif. There is also the preprocessor #import which is equivalent
to:
#ifndef HEADER_H
#define HEADER_H
… defines the header here
#endif
It acts the same as the directive #pragma once to prevent a header from being included
multiple times.

16 
 
Data types

The Objective-C provides four basic data types: int, double, float and char. Just like in C, the
qualifiers long, long long, short, unsigned and signed are placed before the int declaration
to extend the integer range on some systems. Objective –C also provides the id data type
as a generic type, which is used to store an object of any type.
Data types Examples printf() chars
char 'a', '\n' %c
short int — %hi, %hx, %ho
unsigned short int — %hu, %hx, %ho
int 12, -97, 0xFFE0, 0177 %i, %x, %o
unsigned int 12u, 100U, 0XFFu %u, %x, %o
long int 12L, -2001, 0xffffL %li, %lx, %lo
unsigned long int 12UL, 100ul, 0xffeeUL %lu, %lx, %lo
long long int 0xe5e5e5e5LL, 500ll %lli, %llx, &llo
unsigned long long
12ull, 0xffeeULL %llu, %llx, %llo
int
float 12.34f, 3.1e-5f, 0x1.5p10, 0x1P-1 %f, %e, %g, %a
double 12.34, 3.1e-5, 0x.1p3 %f, %e, %g, %a
long double 12.341, 3.1e-5l %Lf, $Le, %Lg
id nil %p
Arrays, structures, unions and pointers are used the same way as in C language.

17 
 
Operators

In Objective-C, just as in most programming languages, the plus sign (+) is used to add two
values, the minus sign (-) is used to subtract two values, the asterisk (*) is used to multiply
two values, and the slash (/) is used to divide two values. These operators are known as
binary arithmetic operators because they operate on two values or terms. The assignment
operators can be used as a combination to the arithmetic operators, just as operator=.
Bitwise operators includes bitwise AND(&), bitwise OR(|), bitwise XOR(^), one
complement(~), left shift(<<) and right shift.

Branching condition and looping

In Objective-C, looping statement (for, do while and while), branching(if, switch, break,
continue) work the same way as they do in C/C++.

Classes and Objects in Objective-C

In Objective-C, class with its attributes and methods is declared by the key word
“@interface”, where the “@implementation” section contains the implementation of the
methods that has been declared in the “@interface” section. The “@interface” is often
stored in the header file .h and the “@implementation” is often stored in the .m or .mm file.
The “@interface” section has the general format:
@interface ClassName: ParentClassName {
//Members’ declarations;
}
// Methods’ declarations;
@end
Member’s declaration has the following format:
(Directive) (Data type) (Variable name)
(Directive) can be either @private, @protected or @public, its meaning is the same as in any
object oriented language.
Members’ declaration has the same form as in C/C++ or Java. However, methods’
declaration is a little bit different:
(method type) (return type) (method name) (:) (Argument type) (Argument name) ;
The method type can only take two values, plus sign (+) or minus sign(-). Plus sign
indicates a class method, which performs some operations on the class itself while minus
sign indicates instance methods, which perform some operations on a particular class. If
the method does not take arguments, the rest after
The “@implementation” has the following format:

18 
 
@implementation ClassName;
// method definition
@end
The Objective-C uses the following syntax for applying methods to classes or instances:
[ClassOrInstance method name]; // for non argument
[ClassOrInstance (method name): arguments]; // for one arguments
The left bracket is followed by the name of a class or an instance of that class, then
followed by one or more spaces and finally is the method that you want to perform.
Multiple arguments: to pass multiple arguments into an Objective-C method, it could be
tricky at the first time:
(Method type) (Return type) (Method name) (:) (Argument type) (Argument name)
(Some name) (:) (Argument type) (Argument name);
In this syntax, and when the method is called, (some name) (:) is used to identify the next
argument.
[ClassOrInstance (method name): argument1 (some name): argument2;]
Examples:
#import <stdio.h>
#import <objc/Object.h>
//------- @interface section -------
@interface SomeClass: Object {
int number;
}
-(void) print;
-(void) setNumerator: (int) n;
@end

//------- @implementation section -------


@implementation SomeClass;
-(void) print {
printf (" %i ", number);
}
-(void) setNumber: (int) n{
numerator = n;
}
@end

19 
 
//------- program section -------
int main (int argc, char *argv[]){
SomeClass *exClass = [[SomeClass alloc] init];//SomeClass *exClass = [SomeClass new]
[exClass setNumber: 1];
// Display
printf ("The number is:");
[exClass print];
printf ("\n");
[exClass free]; // Free memory
return 0;
}

Inheritance

In Objective-C, class that is in the top of the hierarchy is known as root class. Inheritance is
defined as
@interface ClassB: Class A
ClassB is known as subclass (child class) of ClassA and ClassA is known as superclass(parent
class) of ClassB.
Multiple inheritances is an important feature of Objective-C’s approach to object oriented
programming. iPhone’s classes can inherit behaviors and data types from more than one
parent. Take the class UITextView, for example. It’s both text and a view. Like other view
classes, it can appear onscreen. It has set boundaries and a given opacity. At the same time,
it inherits text-specific behavior. You can easily change its display font, color, or text size.
Objective-C and Cocoa Touch combine these behaviors into a single easy-to-use class.

Foundation framework

Foundation framework offers the base for all of programs, allow programmers to work with
basic objects, collections of objects, with dates and times, with auto memory management

Root object of the Foundation framework is NSObject, which can be found in
Foundation/NSObject.h. When working with Foundation framework, any new class should
also have NSObject as its root class, or at least subclass of other objects.
Memory management in Foundation framework is done using the NSAutoreleasePool,
which keeps track of objects for later release. Once created, certain objects and variables
will be automatically added. If not, the method autorelease can be called to add current
object to current auto release pool. The memory occupied can be released using release
method.

20 
 
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; //create an autorelease pool [pool
release]; // release
The Foundation framework also keeps track of the number of reference to an object, which
can be accessed by the method retainCount. When object is created, its reference count will
be set to 1. When the reference count reaches 0, object will be destroyed using dealloc
method.

Model View Controller

MVC separates the way an onscreen object looks from the way it behaves. An onscreen
button (the view) has no intrinsic meaning. It’s just a button that users can push. That
view’s controller acts as an intermediary. It connects user interactions such as button taps
to targeted methods in your application, which is the model. The application supplies and
stores meaningful data and responds to interactions such as these button taps by
producing some sort of useful result. Each MVC element works separately. You might swap
out a push button with, for example, a toggle switch without changing your model or
controller. The program continues to work as before, but the GUI now has a different look.
Alternatively, you might leave the interface as is and change your application where a
button triggers a different kind of response in your model. Separating these elements
enables you to build maintainable program components that can be updated
independently.
The MVC paradigm on the iPhone breaks down into the following categories:
• View. View components are provided by children of the UIView class and by its
associated (and somewhat misnamed) UIViewController class.
• Controller. The controller behavior is implemented through three key
technologies: delegation, target-action, and notification.
• Model. Model methods supply data through protocols such as data sourcing and
meaning by implementing callback methods triggered by the controller.

21 
 
4. Overall Evaluation
4.1. Advantages
After evaluating the iPhone, the following advantages have been clearly noticed:
• 4 abstract layers : safety for developer
• Superior User Interface / experience: Even the people that have never worked with a
computer will be able to use this, since the user interface has been made as easy as
possible
• Easy applications store: you can customize your iPhone possibilities by buying or
downloading extra applications, created by you, a company or an independent
developer.
• Special Features :
• Visual voicemail
• Touch interaction
• Big storage capacity
• Real-time GPS

4.2. Limitations
Sadly, no mobile application development platform is perfect, and we must admit that the
following downsides of this platform have been found:
• 2 devices run the OS: The OS is only allowed to be used on the iPhone and iPod Touch
devices. This doesn’t make it a very practical platform, since no other devices can be
made compatible with them
• Battery is not removable
• Special features must be supported by provider: There are some special features
programmed in the iPhone OS, but if your mobile service provider does not support it,
it will not be usable (for example: Visual Voicemail)
• High price (for unlocked version)

4.3. Conclusion
In conclusion, the iPhone has presented itself as a highly compelling investment on todays
mobile market, it has proved itself to be capable enough to reach many different types of
consumers in many new and innovative ways, as well as to raise its own business model to
attract publishers and developers. For the future, its expected for the iPhone to continue
its ascent on the market as more players take notice for their opportunities to get in, so
should the iPhone stay in people’s minds for a long time to come.

22 
 

Você também pode gostar