iOS8後會碰到 NSXMLParser does not support reentrant parsing 的問題,造成錯誤無法執行。
只要使用 dispatch_queue 另開Thread去執行parse即可解決:
dispatch_queue_t reentrantAvoidanceQueue = dispatch_queue_create("reentrantAvoidanceQueue", DISPATCH_QUEUE_SERIAL);
dispatch_async(reentrantAvoidanceQueue, ^{
self._tmpXMLString = [[NSMutableString alloc] init];
xmlParserS = [[NSXMLParser alloc]initWithData:[request responseData]];
xmlParserS.delegate = self;
[xmlParserS parse];
});
dispatch_sync(reentrantAvoidanceQueue, ^{ });
Reference:
http://www.4byte.cn/question/238 ... ntrant-parsing.html
http://www.bubuko.com/infodetail-567603.html