iPhone 3G mobile phone software development

“IPhone is a revolutionary and magical product, more than any other mobile phone on the market five years ahead,” Apple CEO Steve Jobs says, “is born with fingers with the ultimate pointing device, while the iPhone uses them to create the most innovative since the mouse the user interface. ”
Indeed, iPhone has launched, then in the global handset market has caused a sensation. iPhone mobile phone is called the most beautiful girl, with unparalleled elegance and taste. It is an innovative large-screen, multi-touch interaction, and gravity sensors and other stunning features of the phone not only enables users around the world have a new definition. The wider the programmer provides a beautiful and exciting platform.
App Store combined with the success of this innovative marketing mode operation closer to the majority of creative programmers with the distance between mobile phone users worldwide, making the iPhone platform programmer grassroots entrepreneurship possible. Year to more than 1.5 billion times that App downloads, this great gold are attracting the world’s best and most innovative software engineers to
Bo look at science and technology (www.ibokan.com) as the earliest iPhone 3G platform to engage in the development of intelligent mobile developers in the iPhone platform has made remarkable achievements in the industry, with independent intellectual property rights of the 3G development framework and game physics engine. Samsung Mobile, one of the world’s three core developers.
Bo See Evans (www.ibokanwisdom.com) is the first iPhone 3G software engineer training school for the general who launched a targeted iPhone 3G software development courses. In particular, by sharing with you here, under the iPhone / iTouch Development Foundation and the development process some of the summary.
1, iPhone hardware features
iPhone built-in four kinds of sensors: accelerometer, touch sensors, light sensors and proximity sensors are so many hardware devices on the iPhone for its dazzling feature provides a strong foundation. The use of accelerators, iPhone can detect when the user has rotated the device from portrait to landscape, whether doing rejection, shaking their movements; the use of light sensors, according to ambient light intensity, indoor or outdoor, automatically adjust display brightness to provide the most comfortable visual effects; the use of proximity sensors that can detect when the user has to upgrade iPhone to your ear and immediately turns off the display to save power and prevent inadvertent touches until iPhone is moved away.
2, development environment, introduced
1), iPhone SDK Development Library Framework introduction
Cocoa Touch: programmer-oriented programming interface, including UIKit and the Foundation in two parts. UIKit provides a process, thread management, event, windows, view management. Foundation to provide basic data structures, Cocoa interface to provide all Objective-C mode interface.
Media: This layer provides a more low-level graphics, sound and video in interface. Such as OpenGL-ES, OpenAL, animation, QuartzCore, Video supports H.264, mp4, 3gp, quicktime, etc. compression. Audio support AAC, ALAC, A-law, IMA / ADPCM (IMA4), PCM. It also supports PDF, HTML format, graphic display. Some of this layer interface provided with the Objective-C, some are using the C language interface provided.
Core Services: This layer provides the functionality and Cocoa touch closer to the Foundation functions, except that Core Services provided by the interface is a C language interface, and the system closer to the bottom and efficient.
Core OS: close to the operating system layer provides the interface, C language then Memory, Threads, File System, sNetwork.
2), development tools, Xcode Introduction
Download installed iPhone SDK, the machine will have an Xcode application, XCode is an IDE, and powerful. Support for syntax highlighting, on-line help, project management, debugging breakpoints, single-step tracking and other functions. And XCode and other tools such as the iPhone simulator, the memory checker Instruments, Performance analysis tools to seamlessly integrate Shark is very good.
3), emulator (iPhone Simulator)
iPhone simulator can simulate most of the scenes, and very well integrated, and XCode can breakpoint in Xcode debugging, see the memory leak problem. But the real machine and its equipment, the environment, and there are some differences:
? can not simulate GPRS or EDGE wireless Internet access methods;
? can not simulate multi-point contact operation;
? can not simulate OpenGL-ES;
? simulator CPU and memory, the network is to use PC machine, is relatively abundant, the real device is relatively bad, so very smooth in the simulator run on the application, in the real machine on the device performance may be lower.
? runtime are not totally consistent, in the simulator can run the application may run it up. May be a function not supported in the simulator.
3, how to develop their own iPhone application
? first need a Mac OS X 10.5.4 or later operating system. Mac in the Apple computer and a regular PC install.
? a iPhone or iTouch is indispensable, although the SDK with a simulator, but the simulated environment and real environment is very different.
? download and install the iPhone SDK (Xcode), SDK is free.
? apply for license, this is not free, there are 99 U.S. dollars and 299 U.S. dollars two kinds of license.
? familiar with Objective-C language, iPhone is to use the interface library written in Objective-C language, are familiar with Objective-C syntax is a required path.
? write code, compile, debug, release.
4, iPhone application of design principles
The new iPhone development platform, it belongs to the classification on embedded development, and many other embedded development follow the same principles, same time, it also has its own characteristics.
1), One Application at a Time
At the same time there can be only one application to run. This rule is the Apple company gave developers a straitjacket. In fact, iPhone OS is a multi-process system. When you boot the iPhone, at least more than 10 processes running in the background. However, given Apple developers the choice of this limit is also helpless. The reason is the physical memory, although the iPhone has 116M, but the iPhone OS does not support virtual memory, that is, not as advanced as the operating system for large memory storage devices through. In addition, iPhone a start, there are more than 10 system applications running, this time leaving the user can use the memory space is only 4-5M can be used. So little memory, combined with iPhone applications are graphics applications, there can not be split among several processes at the same time.
2), One Window at a Time
There is only one window at the same time, iPhone is a handheld device, follow the convenient input and output can not be like the application of PC, as superposition of multi-window drag and drop. Basically, iPhone is full screen for each interface.
3), Reducing Memory Use
This is the development of staff in the development process at all times to wear a principle in their hearts. As described in the first. iPhone system memory is extremely lacking. Minimize the use of long-term occupation of memory, run out immediately released.
4), Reducing Power Consumption
To reduce power consumption. iPhone is the iPhone power-one of several major drawbacks. Network, telephone, video video, 3D these calls are the major reasons leading to power, if your application of these calls, then you should consider if the province of the point of use, such as reducing network traffic and other methods.
5), Fast Launch, Quickly Out
This is to ask the user software should have a good sense of user experience, start fast, quit fast. Can not be a long time did not respond to user actions.
5, the application program structure description
1), application life cycle and the event loop
Applications from the beginning click the desktop shortcut, they were loaded into memory in the system, in the so-called sandbox environment to run as a process. After a series of initialization in the main loop start receiving and processing events (timer, the user clicks, network events, the memory is not enough system event, power is not enough system events). When the user presses the Home button, the application will quit, the release of their own resources.
2), sand box
Application Sandbox is to provide a limit to the application runtime environment. On the application of many operations have done a licensing restrictions. Such as file reading and writing, the application can only access certain restricted files in that directory, as well as network and other hardware equipment, access control, have done limited.
The application’s directory defined as follows, MyApp.app directory is read-only, Documents can read and write access, Library read-only, tmp can read and write.
6, UIKit Control Introduction
iPhone development tools support the C language Xcode and Objective-C language, can be mixed compilation, developers can use as in other platforms, like C language to write their own data structure management data. However, if you want to create windows and controls, then, you have to use Objective-C syntax, because UIKit interface is Objective-C interface.
UIKit is the iPhone interface developed by libraries, provides a rich interface elements:
UIWindow: an application has one and only one window, window is a container can only put a UIView;
UIView: used to display the area, UIView all the other interface controls the parent class. UIView can be used as a container, put several sub-View;
UIButton: inherit from UIView in response to a user clicks on the event;
UILable: inherit from UIView, static read-only text labels;
UITextField: from UIView inheritance, single-line text input control.
UITextView: multi-line text input
UIWebView: Show Html Web Controls.
UINavigationBar: navigation bar;
UITabBar: Toolbar;
UIAlertSheet / UIAlertView: modal dialog
UISwitchCtrl: fairly and RadioBox, 2 choose one.
UISegmentCtrl: one of many
UITableView: Display List
UISlider: that progress or percentage of
UIProgressView: that of progress. .
UIPickerView: a bit like in the cases of Combox function, one of many
7, Summary
iPhone OS provides a very powerful development platform, there are many powerful system calls allow you to write a dazzling applications. Certain points of view, iPhone OS is not an embedded operating system, it is almost all the features with the desktop operating system. At the same time it is there are many restrictions, is not enough memory, CPU frequency is too low and can not run in the background. How to make full use of limited resources on the characteristics of these systems is that the test system developers to design capabilities and programming foundation of the
