找回密碼
 註冊
搜索
查看: 3214|回復: 0

Objective C iOS NSXMLParser does not support reentrant parsing

[複製鏈接]
發表於 2015-12-24 12:52:49 | 顯示全部樓層 |閱讀模式
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

相關帖子

您需要登錄後才可以回帖 登錄 | 註冊

本版積分規則

Archiver|手機版|彩色筆小沛的知識庫

GMT+8, 2024-3-29 21:35 , Processed in 0.017582 second(s), 13 queries , Gzip On, MemCache On.

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回復 返回頂部 返回列表