IPhone development overview

Source: Internet
Author: User

IPhone development overview

### IPhone development overview

Sandbox in iOS is a security system that specifies that an application can only read files in a folder created for the application, you cannot access contents from other places. all non-code files are stored in this place, such as slice, sound, attribute list, and text files. Every application in its own sandbox cannot freely cross its own sandbox to access other people's sandbox content applications to request or receive data requires permission authentication of the application five statuses Not runing (Not running) the Inactive program is not started and runs on the foreground. However, no event is received. in the absence of event processing, the program usually stays in this status. The Active (Active) program runs at the foreground and receives the event. this is also a normal Background (Background) program at the front end and can execute code. After most programs enter this state, they will stay in this state for a while. after the time is reached, it will be Suspended ). some programs can be in the Background state for a long time after special requests. the sushortded (Suspended) program cannot execute code in the background. the system will automatically turn the program into this state and will not send any notifications. when suspended, the program remains in the memory, and the life cycle of the application state in the program memory

This method is called when the iOS app is loaded and the app is almost ready to run. We usually need to use this method to complete app initialization and final settings. this method is called before the window and UI of the app.

- (BOOL)application:(UIApplication *)application didFinishLanunchingWithOption:(NSDictionary *)LaunchOptions

When the application is about to enter the inactive state for execution, during this period, the application does not accept messages or events, such as phone calls or screen locks. It is usually implemented in this method: stop timer and other periodic tasks, stop any running requests, pause video playback, pause it if it is a game, reduce the Frame Rate of OpenGL ES, scrape any distribution queue and unimportant operation Queue (you can process network requests or other time-sensitive background tasks ).

- (void)appliWillResignActive:(UIApplication *)application

When the application enters the active state for execution, this state is just the opposite of the method above. You need to re-start the task, for example, re-start timer, continue to distribute the queue, and improve the Frame Rate of OpenGL ES. however, the game must be paused and cannot start automatically.

- (void)applicationDidBecamActive:(UIApplication *)appliction

Called when the program is pushed to the background. so to set the background to continue running, you can set it in this function. this method needs to be implemented: to save user data or status information, all files or information not written to the disk, and write it to the disk at the end of the process, because the program may be killed in the background, release the memory as much as possible.

- (void)applicationDidEnterBackground:(UIApplication *)application

It is called when the program returns the program to the foreground from the background, which is the opposite of the method above.

- (void)applicationWillEnterForeground(UIApplication *)application

When the program is about to exit, it is usually called to save data and clean up before exiting. This requires setting the key value of UIApplicationExitsOnSuspend.

- (void)applicationWillTerminate:(UIApplication *)application
The main function of the main function is the entry to program startup. In the iOS app, the main function is minimized, and the main work is handed over to the UIKit framework.
# import 
  
   # import PNAppDelegate.hint main(int argc, char * argv[]){    @autoreleasepool{        return UIApplicationMain(argc,argv,nil,NSStringFromClass([PNAppDelegate class]));    }}
  

The UIApplicationMain function has four functions. You do not need to change these parameter values. However, we need to understand how these parameters and programs start: the argc and argv parameters contain the startup time brought by the system. the third parameter determines the name of the main application class. This parameter is specified as nil, so that UIKit uses the default UIApplication class to create an object. the fourth parameter is the program-defined proxy class name, which is responsible for interaction between the system and code. it is generally automatically generated when a new project is created in Xcode.
In addition, the UIApplicationMain function loads the file on the main interface of the program. Although this function loads the interface file, it is not stored on the windows of the application.

It is important to understand the following three things that UIApplicationMain does:
1. Create a UIApplication object based on the third parameter.
2. Create the application's delegate according to the fourth parameter and set the delegate.
3. Set the main event loop, including the application's run loop, and start to process the event.

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.