Click here to Skip to main content
12,450,352 members (44,824 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: C XML Mobile iPhone Objective-C , +
Hi Everyone,

I've been working on an iPhone application which parses XML in the format of:

<PEOPLE>
<PERSON NAME="KAREL" AGE="23" />
<PERSON NAME="KEES" AGE="23" />
</PEOPLE>

Next to this, i've made a class PersonClass with both the variable Name and Age.

Now in the file where i'm reading the XML i've set the following:

<pre lang="c#">
#import "PeopleStruct.h"

@interface PeopleData: NSObject {
      Person *currentPerson;
     
      NSMutableArray *allPeople;
      NSXMLParser *parser;
}
@property (readonly, retain) NSMutableArray *allPeople;

- (id)readPeopleXML;

@end
</pre>

In the PeopleData file i've put an @Synthesize allPeople;

And i'm reading the people like this:
<pre lang="c#">-(void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName attributes:(NSDictionary *)attributeDict
{
      if ([elementName isEqualToString:@"PERSON"])
      {
            currentPerson = [PersonClass alloc];
            currentPerson.name = [attributeDict objectForKey:@"NAME"];
            currentPerson.age = [attributeDict objectForKey:@"AGE"];
           
            [allPeople addObject:currentPerson ];
            currentPerson = nil;
      }
}</pre>

However, the app fails to build the application because of the line:
currentPerson = [PersonClass alloc];

And throws the error:

Undefined symbols for architecture i386:
   "_OBJC_CLASS_$_PersonClass", referenced from:
         objc-class-ref in PeopleData.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Anyone who could tell me how to bypass this?

Yours Sincerely,
Lars


Thanks in advance Smile | :)
Posted 16-Feb-12 2:59am
larssy1367

1 solution

Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

Hi,

Shouldn't you be calling
currentPerson = [[PersonClass alloc] init];
instead ?

Or maybe you missed the
#import PersonClass.h
?

Anyway, I'm not sure of what I'm saying.
  Permalink  
Comments
larssy1 16-Feb-12 9:25am
   
1. No, you don't have to do the init.
2. No, I sadly didn't forget to put that import :[
_Zorro_ 16-Feb-12 9:27am
   
Well, I'm sorry then... good luck with that!
Edit: Does this helps? -> http://stackoverflow.com/questions/8724796/symbols-not-found-for-architecture-i386
larssy1 16-Feb-12 9:33am
   
Nope, didn't fix it either. Next to this, the same functionality works somewhere else.. but it fails in this part.
_Zorro_ 16-Feb-12 9:43am
   
I did have some problems with the simulator data that had to be cleared and CoreData framework not beeing loaded but I'm just starting ios development so I won't be able to help you unless it was something really stupid... :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web01 | 2.8.160826.1 | Last Updated 16 Feb 2012
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100