Skip to main content

Posts

Showing posts with the label GCD

GCD Example

test.h { dispatch_queue_t backgroundQueue ; } test.m - ( void )viewDidLoad {     [ super viewDidLoad ];    //com.unique.uniqueidentifier.youtube is any unique name     backgroundQueue = dispatch_queue_create ( "com.unique.uniqueidentifier.youtube" , NULL );      } -(void)anyFunction {        dispatch_async ( backgroundQueue , ^( void ){              [ self sendRequestForData ];        }); } -( void )sendRequestForData {     NSString *post = @"" ;     NSData *postData = [post dataUsingEncoding : NSISOLatin1StringEncoding allowLossyConversion : NO ];     NSMutableURLRequest *urlRequest = [[[ NSMutableURLRequest alloc ] init ] autorelease ];     [urlRequest setURL :[ NSURL URLWithString: < any url string for fetching dat...