Wednesday, 6 January 2016

Background thread

    dispatch_async( dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
            // Add code here to do background processing

            dispatch_async( dispatch_get_main_queue(), ^{
                // Add code here to update the UI/send notifications based on the
                // results of the background processing
            });

        });

(OR)

    dispatch_async( dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^(void){
            // Add code here to do background processing

            dispatch_async( dispatch_get_main_queue(), ^(void){
                // Add code here to update the UI/send notifications based on the
                // results of the background processing
            });
        });

No comments:

Post a Comment