@interface SignDocumentController : UIViewController<NSXMLParserDelegate> {
NSMutableString *signFaxString;
NSString * messageId;
NSMutableData *xmlData;
NSURLConnection *connectionInprogress;
NSURLConnection *connectionInprogress2;
NSString * annotationKey;
NSString *firstName;
NSString *lastName;
NSString *date;
NSString *signature;
IBOutlet UIImageView *image;
}
@property(nonatomic,retain)UIImageView * image;
@end
-(void)parser:(NSXMLParser *)parser
didStartElement:(NSString *) elementName
namespaceURI:(NSString *)namespaceURI
qualifiedName:(NSString *)qName
attributes:(NSDictionary *)attributeDict
{
if ([elementName isEqual:@"SignatureInfo"]) {
signFaxString = [[NSMutableString alloc]init];
firstName = [attributeDict objectForKey:@"FirstName"];
lastName = [attributeDict objectForKey:@"LastName"];
date = [attributeDict objectForKey:@"Date"];
signature = [attributeDict objectForKey:@"Signature"];
}
if ([elementName isEqual:@"AddAnnotationResult"]) {
signFaxString = [[NSMutableString alloc]init];
}
}
the values for firstName, lastName, date, signature do not stay and I get an error when I try accessing firstName, lastName ETC in a different method:
[CFString respondsToSelector:]: message sent to deallocated instance 0x4ec63b0
I have tried using :
firstName = [NSString stringWithString attributeDict objectForKey:@"FirstName"];
but that does not work either. I know this is a silly question but I could use some help.
Thanks
you could also declare the
firstNameand others as property andretain. As belowAnd in .m class.
and release them in
deallocfunction.Use with
selfall your property variable in you class.EDITED:
Also consider @bbum comment ..