I met a problem with NSXMLParser. My source is run well in iOS7/XCode 5, but crashing in iOS8.1/XCode 6. Crashing error is:
Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'NSXMLParser does not support reentrant parsing.'
I tried with other solution in this post, but error still happened. Anyone can help me more?
My source like this
AppDelegate.h
@interface AppDelegate : UIResponder <UIApplicationDelegate, NSXMLParserDelegate>
{
NSXMLParser *xmlParser_;
...
}
AppDelegate.m
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
[self parseData];
....
}
- (void)parseData
{
titleList_ = [[NSMutableArray alloc] init];
NSString *filePath = [[NSBundle mainBundle] pathForResource:fDetail ofType:fXML];
if (filePath)
{
NSString *myText = [NSString stringWithContentsOfFile:filePath encoding:NSUTF8StringEncoding error:nil];
if (myText)
{
countPage_ = 2;
NSData *xmlData = [myText dataUsingEncoding:NSUTF16StringEncoding];//NSUTF8StringEncoding];
xmlParser_ = [[NSXMLParser alloc] initWithData:xmlData];
xmlParser_.delegate = self;
[xmlParser_ parse];
}
}
}
The same code works fine for me in iOS 8/XCode 6. Here is my code:
@end