0
這在主線程上正常工作,但由於某種原因在後臺線程上運行時不起作用。如果你只是註釋掉調用dispatch_async比程序工作正常!TFHpple請求不在後臺線程上運行?
代碼:
NSString *requestString = [NSString stringWithFormat:@"http://www.songlyrics.com/index.php?section=search&searchW=%@+%@&submit=Search",actualSongName,actualSongArtist];
NSLog(@"0");
TFHpple *requestParser = [TFHpple hppleWithHTMLData:[NSData dataWithContentsOfURL:[NSURL URLWithString:requestString]]];
NSLog(@"1");
NSString *requestedURLXPathQuery = @"//a";
NSArray *requestedStringsNodes = [requestParser searchWithXPathQuery:requestedURLXPathQuery];
NSLog(@"2");
這是記錄的內容:
2012-10-11 21:39:05.636 SuperViewer[6612:110b] 0
2012-10-11 21:39:05.651 SuperViewer[6612:907] Unable to parse.
2012-10-11 21:39:06.520 SuperViewer[6612:110b] 1
2012-10-11 21:39:06.565 SuperViewer[6612:110b] 2
這是在後臺線程上運行的。 另外我已經記錄了「requestString」var和它的罰款。
任何想法是什麼問題? Hpple不能在後臺線程上運行嗎?
謝謝!
這是行不通的。我得到了完全相同的錯誤。 – Shredder2794
或嘗試使用此塊http://pastebin.com/KNMYjZpp –
這就是我最初做的......因此,無意中這也不起作用。任何其他想法? – Shredder2794