由NSXMLParser引起的崩溃不支持可重入解析

时间:2015-03-12 09:40:54

标签: ios objective-c bing-maps

我刚开始学习将BingMaps集成到iOS应用程序中。 我刚从http://blogs.bing.com/maps/2011/05/05/new-bing-maps-ios-sdk/下载了一些示例应用程序。

我得到了

**Terminating app due to uncaught exception NSInternalInconsistencyException', reason: 'NSXMLParser does not support reentrant parsing.'**  

我只是将[_myMapView setDelegate:self];放在viewdidload中。

请告诉我解决问题的最佳方法。

我也试过

dispatch_queue_t reentrantAvoidanceQueue = dispatch_queue_create("reentrantAvoidanceQueue", DISPATCH_QUEUE_SERIAL);
dispatch_async(reentrantAvoidanceQueue, ^{
    [_myMapView setDelegate:self];
});
dispatch_sync(reentrantAvoidanceQueue, ^{ });

但同样的问题也会发生。

FYI,

*** Terminating app due to uncaught exception NSInternalInconsistencyException', reason: 'NSXMLParser does not support reentrant parsing.'
*** First throw call stack:
(
0   CoreFoundation                      0x00374946 __exceptionPreprocess + 182
1   libobjc.A.dylib                     0x01411a97 objc_exception_throw + 44
2   CoreFoundation                      0x0037486d +[NSException raise:format:] + 141
3   Foundation                          0x010ccb6c +[NSXMLParser setCurrentParser:] + 172
4   Foundation                          0x010cd4cd -[NSXMLParser parseFromStream] + 67
5   Foundation                          0x010cd71e -[NSXMLParser parse] + 33
6   MyBingMap                           0x00108353 -[BMMapConfiguration parser:didEndElement:namespaceURI:qualifiedName:] + 336
7   Foundation                          0x010d046c _endElementNs + 763
8   libxml2.2.dylib                     0x007978c7 xmlParseEndTag2 + 841
9   libxml2.2.dylib                     0x00799fbf xmlParseTryOrFinish + 3601
10  libxml2.2.dylib                     0x00798fb2 xmlParseChunk + 952
11  Foundation                          0x010cd0fd -[NSXMLParser parseData:] + 314
12  Foundation                          0x010cd3d8 -[NSXMLParser parseData:] + 1045
13  Foundation                          0x010cd5bd -[NSXMLParser parseFromStream] + 307
14  Foundation                          0x010cd71e -[NSXMLParser parse] + 33
15  MyBingMap                           0x00107bce -[BMMapConfiguration networkData:withState:withHttpStatus:withHttpHeaders:] + 224
16  MyBingMap                           0x000fe777 -[BINetworkWorkOperation _callDelegate] + 1554
17  MyBingMap                           0x000fe071 -[BINetworkWorkOperation main] + 313
18  Foundation                          0x00fb4567 -[__NSOperationInternal _start:] + 700
19  Foundation                          0x00fb4299 -[NSOperation start] + 83
20  Foundation                          0x00fb40e3 __NSOQSchedule_f + 237
21  libdispatch.dylib                   0x02eb0e2f _dispatch_client_callout + 14
22  libdispatch.dylib                   0x02e96afc _dispatch_queue_drain + 1475
23  libdispatch.dylib                   0x02e963c3 _dispatch_queue_invoke + 212
24  libdispatch.dylib                   0x02e99067 _dispatch_root_queue_drain + 466
25  libdispatch.dylib                   0x02e9a87e _dispatch_worker_thread2 + 45
26  libsystem_pthread.dylib             0x0321cdab _pthread_wqthread + 336
27  libsystem_pthread.dylib             0x03220cce start_wqthread + 30
)
libc++abi.dylib: terminating with uncaught exception of type NSException

请告诉我解决此问题的最佳方法。

1 个答案:

答案 0 :(得分:0)

请勿使用Bing Maps iOS控件。它在几个月前被弃用了。而是在WebBrowser控件中使用Bing Maps V7 JavaScript控件。您最终会获得更多功能,并且性能非常好。 iOS上几乎所有使用Bing Maps的应用程序都是这样做的。