Objective-C + [CATransaction Synchronization] called inside a transaction

I have this error: +[CATransaction synchronize] called within transactionbut I do not understand what is the point of this.

I found that an error occurs on this line:

-(void)NSURLConnectionFunction:(NSString *)feedURLString
{
    @try{
        m_stopRunLoop = NO;

        NSData *postData = [feedURLString dataUsingEncoding:NSUTF8StringEncoding];
        NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:[NSURL URLWithString:feedURLString] cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:180];
        NSString *postLength = [[NSString alloc] initWithFormat:@"%d", [postData length]];
        [request setHTTPMethod:@"POST"];
        [request setValue:postLength forHTTPHeaderField:@"Content-Length"];

        NSURLConnection *conn = [[NSURLConnection alloc] initWithRequest:request delegate:self];

        if(conn){
            webData=[NSMutableData data];
        }
        do
        {
            // ERROR APPEAR HERE
            NSDate* cycle = [NSDate dateWithTimeIntervalSinceNow:0.5];
            [[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode
                                     beforeDate:cycle];
        }
        while ( ! m_stopRunLoop );
    }
    @catch (NSException *e){
        NSLog(@"Exception %@",e);
    }
}

Thank you for your promotion.

+4
source share

Source: https://habr.com/ru/post/1547162/


All Articles