在事务中调用的Objective-C + [CATransaction synchronize]

时间:2014-07-04 11:48:34

标签: ios objective-c

我有这个错误:+[CATransaction synchronize] called within transaction但我不明白这是什么意思。

我检测到此行发生错误:

-(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);
    }
}

感谢您提前。

0 个答案:

没有答案