Note that there are some explanatory texts on larger screens.

plurals
  1. PONSUnknownKeyException - setValue: forUndefinedKey in classfile
    primarykey
    data
    text
    <p>I am pretty new to iPhone development and I am getting this error output. I know what is happening, I just don't know how to fix it.</p> <pre><code> Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[&lt;loginData 0x6b1c&gt; setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key UserEMailAddress.' </code></pre> <p>Basically I am using the XML parser and trying to store data into my created class 'loginData.' The first element I come to, is UserEMailAddress and the code is trying to store that value into the class variable UserEMailAddress of the same name. But its throwing that error.</p> <p>Obviously something went awry when I created my class. Somehow I guess things were not set up right and it can't input the data into the class. All I did to create loginData was do a file->new-> class object.</p> <p>Here is the class code.</p> <p>loginData.h</p> <pre><code>#import &lt;Foundation/Foundation.h&gt; @interface loginData : NSObject{ NSString *UserEMailAddress; NSString *SessionUID; NSString *SessionExpirationUTCDT; } @property (nonatomic, retain) NSString *UserEMailAddress; @property (nonatomic, retain) NSString *SessionUID; @property (nonatomic, retain) NSString *SessionExpirationUTCDT; @end </code></pre> <p>loginData.m</p> <pre><code> #import "loginData.h" @implementation loginData @synthesize UserEMailAddress=_UserEMailAddress; @synthesize SessionUID=_SessionUID; @synthesize SessionExpirationUTCDT=_SessionExpirationUTCDT; @end </code></pre> <p>pretty simple stuff, nothing too complex.</p> <p>the last method accessed before the crash is in my XMLParser, which is..</p> <pre><code>- (void)parser:(NSXMLParser *)parser foundCharacters:(NSString *)string { if (!currentElementValue) { // init the ad hoc string with the value currentElementValue = [[NSMutableString alloc] initWithString:string]; } else { // append value to the ad hoc string [currentElementValue appendString:string]; } NSLog(@"Processing value for : %@", string); } </code></pre> <p>I'm sure I just made a small mistake in making my class, but I don't know what that would be. Thanks in advance.</p> <p>The only other method where it looks as if the variables are input to my class is this one.</p> <pre><code> - (void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName { if ([elementName isEqualToString:@"LoginResponse"]) { // We reached the end of the XML document return; } //if ([elementName isEqualToString:@"user"]) { // We are done with user entry – add the parsed user // object to our user array //[users addObject:user]; // release user object //[user release]; //user = nil; // } else { // The parser hit one of the element values. // This syntax is possible because User object // property names match the XML user element names [loginData setValue:currentElementValue forKey:elementName]; } currentElementValue = nil; } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload