Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 10-21-2010, 12:03 PM   #1 (permalink)
Registered Member
 
Join Date: Oct 2010
Posts: 4
brinck10 is on a distinguished road
Default Problem with NSInternalInconsistencyException

Hi there guys.

I'm hitting a wall over and over again, trying to solve a problem I've got in xcode. I'm a newbie and started coding just a while ago.

I'm trying to make a XML parser based on this tutorial: Iphone Tutorial: Creating a RSS Feed Reader

which works fine separately, but when I'm implementing it into my own project, I get the 'NSInternalInconsistencyException' error, as a result of the following code:

PHP Code:
----FileParser.m----

- (
void)parserDidEndDocument:(NSXMLParser *)parser {
 if ([
_delegate respondsToSelector:@selector(parsedInformation::)]){
     [
_delegate parsedInformation:information];
 }else{
     [
NSException raise:NSInternalInconsistencyException
     format
:@"Delegate (%d) doesn't respond to parsedInformation:"_delegate];
    }

I've tried to remove the if-phrase, and then it calls the correct function, but the data which is supposed to be overhanded, won't get through.

Project setup

The project is a tab-based application. I'm having three classes:

* Parser
* AlphaTab
* RootDelegate

In RootDelegate I used the following code to initialize the tab-view, and then to initialiaze the AlphaTab as a tableView being part of a navigationView:

PHP Code:
 ----RootDelegate.----

tabBarController = [[UITabBarController allocinit];
alphaTab = [[AlphaTab allocinitWithTabTitle:@"AlphaTab" navigationTitle:@"Exploring"];

UINavigationController *tableNavController = [[[UINavigationController allocinitWithRootViewController:alphaTabautorelease];
tableNavController.delegate self;
[
alphaTab release];  // creates your table view's navigation controller, then adds the created view controller. Note I then let go of the view controller as the navigation controller now holds onto it for me. This saves memory. 
So good so far.. the problem comes when I use the Parser class, which parses a given XML file. This class is initialized and only implemented in the AlphaTab - therefore it has nothing to do with the RootDelegate class at all. The initialization is done as:

PHP Code:
----File AlphaTab.----

- (
void)loadData{
  if(
information==nil){
  
Parser *XMLParser = [[Parser allocinit];
  [
XMLParser parseFeed:@"http://frederikbrinck.com/bodil/Example.xml" withDelegate:self];
  [
XMLParser release];
  }else {
     [
self.tableView reloadData];
  }


I'm suspecting the parameter withDelegate's value "self" to be the problem, which I think referres to the super class RootDelegate, but I'm not sure. Likewise, I don't know to pass the AlphaTab class' delegate to the function, which I think would solve the problem.

I'm ought to think, that the problem could be created from this line aswell:
PHP Code:
----FILEParser.----

@
protocol AlphaTab <UITableViewDelegate>
     - (
void)parsedInformation:(NSArray *)i;
@
end 
I've done some research about protocols and respondsToSelector, but honestly, I didn't understand much, since my code is seen from the programmatic perspective of view, without using the InterfaceBuilder at all, since I've been adviced to do that. It hasn't lead to the solution of the problem either.

For further understanding, I then want this function in AlphaTab.m to be called, when the information is parsed.

PHP Code:
----FILE AlphaTab.----

- (
void)parsedInformation:(NSArray *){
    
NSLog(@"The parser has completed parsing");
    
information i;
    
NSLog(@"This is the information: %d", [[information objectAtIndex:0objectForKey:@"tabTitle"]);
    [
self.tableView reloadData];

I've looked on the net, and I found some explications about the NSInternalInconsistencyException. I've tried to do them as well, for example by setting everybody with themselves as delegates. However, I had no luck. What wonders me most, is that when I use the Parser without having to subclass it's caller (this case: AlphaTab) to a main class, it works like a charm.

I hope you guys can give me a clue. If you need any more information please ask, and I'll be in disposition.

//Brinck10
brinck10 is offline   Reply With Quote
Reply

Bookmarks

Tags
nsinternalinconsistency, nsxmlparser, nsxmlparserdelegate, protocol, respondstoselector

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 347
9 members and 338 guests
condor304, Desert Diva, dre, hain, mottdog, oceanlablight, palme2elie, schmallegory
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,658
Threads: 94,118
Posts: 402,895
Top Poster: BrianSlick (7,990)
Welcome to our newest member, palme2elie
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 01:11 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0