Click here to Skip to main content
15,881,803 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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 :)
Posted

1 solution

Hi,

Shouldn't you be calling
C++
currentPerson = [[PersonClass alloc] init];

instead ?

Or maybe you missed the
C++
#import PersonClass.h

?

Anyway, I'm not sure of what I'm saying.
 
Share this answer
 
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)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900