среда, 27 февраля 2019 г.

NSURLConnection using setDelegateQueue

Почему-то подвешивает приложение в дебаге. 
Не всегда, но достаточно часто.


    NSURLConnection *conn = [[NSURLConnection alloc] initWithRequest:req delegate:self startImmediately:NO];
    [conn setDelegateQueue:[self.class delegateQueue]];
    [conn start];


+(NSOperationQueue*)delegateQueue{
    static dispatch_once_t onceToken;
    static NSOperationQueue *q = nil;
    dispatch_once(&onceToken, ^{
        q = [[NSOperationQueue alloc] init];
        q.maxConcurrentOperationCount = 1;
    });
    return q;
}


Нашел что какие-то подобные проблемы были в iOS 5

Комментариев нет:

Отправить комментарий