iOS enter background

If yout want to do something in background…

__block UIBackgroundTaskIdentifier backgroundId =
[[UIApplication sharedApplication] beginBackgroundTaskWithExpirationHandler:^{
    [[UIApplication sharedApplication] endBackgroundTask:backgroundId];
    backgroundId = UIBackgroundTaskInvalid;
}];

dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, (unsigned long)NULL), ^{
    // do some thing you want to ...
});
iOS  cocoa