我更新爲xcode 4.4(與蘋果LLVM編譯器4.0),並從那時起,當我嘗試在控制檯xcode和應用程序(在模擬器)塊用戶打印XML互動...我需要等待30秒或更長時間直到完成(我什麼都不能做)蘋果LLVM編譯器4.0凍結Xcode和應用程序時打印XML(NSLog)
我使用AFNetworking和TBXML,但問題不在於解析,因爲如果我刪除解析問題繼續。
因此,我嘗試NSOperationQueue,NSBlockOperation,大調度中央......沒有什麼,仍然凍結。
是因爲XML太大? (...我需要打印XML調試和測試的東西)
1°的請求和打印XML
- (void) doRequestPOST:(NSString*)URL params:(NSString*)params withSuccess:(void(^)(BOOL,id))successBlock{
(....)
AFHTTPRequestOperation *op = [sharedAPI HTTPRequestOperationWithRequest:request success:^(AFHTTPRequestOperation *operation, id responseObject) {
NSString* xml = [[NSString alloc] initWithData:responseObject encoding:NSUTF8StringEncoding];
//>>>>>PROBLEM HERE<<<<< if i remove next line (nslog) the problem does not occur
NSLog(@"\n\nResponse \nURL :\n%@\nXML :\n%@\n \n",operation.request.URL,xml);
[xml release];
TBXML * tbxml = [TBXML newTBXMLWithXMLData:responseObject error:nil];
[self saveCookiesFromHTTPHeaderFields:[operation response] withTBXML:tbxml.rootXMLElement];
if (successBlock) {
successBlock(TRUE,responseObject);
}
}
2º會詢問請求並解析「successBlock 響應(TRUE, responseObject);」
[self doRequestPOST:stringURL params:nil withSuccess:^(BOOL success, id response) {
if (success) {
//will parse response
[self.dictionaryCategoryContents setObject:[Parser parseVodContent:response] forKey:idCategory];
if (responseBlock){
responseBlock (YES,[dictionaryCategoryContents objectForKey:idCategory]);
}
}else {
if (responseBlock){
responseBlock (NO,response);
}
}
}];
XML有多大? (log'[responseObject length]')。 – trojanfoe 2012-07-27 11:10:41
[響應對象長度] 44419 – silvaric 2012-07-27 11:15:18