justin
justin

Reputation: 46

dispatch_get_global_queue set flags = 1 , the crash

- (void)viewDidLoad {
    [super viewDidLoad];

    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 1), ^{ 
        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(listenNotification:) name:@"aysNofitication" object:nil];
    });
}

the code will crash when I set the flags 1.

the crash is : Thread 1: EXC_BAD_ACCESS(code=1, address=0x50)

Upvotes: 1

Views: 239

Answers (1)

Rob
Rob

Reputation: 437472

As Sermandurai Subbiah said, you simply should not use anything other than 0 for the flags parameter of dispatch_get_global_queue. The documentation for dispatch_get_global_queue clearly warns us:

Flags that are reserved for future use. Always specify 0 for this parameter.

Upvotes: 1

Related Questions