ios_links
Media
Security
File
Application
Network
iOS
- Application life cycle
- concurrent programming
- Key-value observing which is a mechanism that allows objects to be notified of changes to specified properties of other objects.]
- utility
- webkit (javascriptcore project)
- using JavascriptCore
- create IPA file
Background task
- background task
- Executing a Finite-Length Task in the Background
- Tasks wrapped in beginBackgroundTask… and endBackgroundTask: are allowed to continue execution for approximately 10 minutes in the background
-(void) applicationDidEnterBackground
{
if ([[UIDevice currentDevice] respondsToSelector:@selector(isMultitaskingSupported)]) { //Check if our iOS version supports multitasking I.E iOS 4
if ([[UIDevice currentDevice] isMultitaskingSupported]) { //Check if device supports mulitasking
UIApplication *application = [UIApplication sharedApplication]; //Get the shared application instance
__block UIBackgroundTaskIdentifier background_task; //Create a task object
background_task = [application beginBackgroundTaskWithExpirationHandler: ^ {
[application endBackgroundTask: background_task]; //Tell the system that we are done with the tasks
background_task = UIBackgroundTaskInvalid; //Set the task to be invalid
//System will be shutting down the app at any point in time now
}];
//Background tasks require you to use asyncrous tasks
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
//Perform your tasks that your application requires
NSLog(@"\n\nRunning in the background!\n\n");
[application endBackgroundTask: background_task]; //End the task so the system knows that you are done with what you need to perform
background_task = UIBackgroundTaskInvalid; //Invalidate the background_task
});
}
}
}
http://mobileorchard.com/tutorial-networking-and-bonjour-on-iphone/
This should be a good start.
You can keep the connection alive for upto 10 minutes
UIBackgroundTaskIdentifier myLongTask;
myLongTask = [[UIApplicationsharedApplication]
beginBackgroundTaskWithExpirationHandler:^{
// If you're worried about exceeding 10 minutes, handle it here
}];
[[UIApplication sharedApplication] endBackgroundTask:myLongTask];
This will give you 10 minutes to check for a connection. After 8 minutes, you can use a local Push notification asking the user to open the app to extend it for another 10 minutes.
Device
JailBreak app dev
page revision: 36, last edited: 01 Dec 2012 07:30