I’m assigning a variable string from an XML node and for some reason when i’m using it later i’m getting it read like this:
edit
The Current URL to parse is a NSLog that is written when the page is loaded from the [loadXML currentCat]]
NSLog:
Current URL To Parse: <UILongPressGestureRecognizer: 0x677c240; state = Possible; view = <UITableViewCellContentView 0x67780b0>; target= <(action=_longPressGestureRecognized:, target=<UITableViewCell 0x677c340>)
tempFullUrl being set – this is in my class.h
@interface PromotionViewController : UITableViewController {
NSString *tempFullUrl;
}
@property (nonatomic, retain) NSString *tempFullUrl;
@end
It’s also synthasised in the .m
Var being Set:
NSArray *urlArray = [item elementsForName:kName_url];
for(CXMLElement *url in urlArray)
{
newobj.urlSearch = url.stringValue;
tempFullUrl = url.stringValue;
NSLog(@"Temp Full URL: : %@", tempFullUrl);
[url release];
[kName_url release];
}
[totalArray addObject:newobj];
}}
Var being used:
else if(currentType == @"p2FullSearch") {
NSString *searchType = @"categorySearch";
PromotionViewController *loadXML = [[PromotionViewController alloc] initWithNibName:@"PromotionViewController" bundle:nil];
[loadXML setCurrentCat: tempFullUrl];
[loadXML setCurrentType: searchType];
[self.navigationController pushViewController:loadXML animated:YES];
}
The app falls over, highlighting the tempFullUrl = url.stringValue; line but doesn’t say why! I assume as the var tempFullUrl is being set weirdly
Any help would be appreciated
Tom
You’re not going through your synthesised accessor, so the string is getting released. Use
Instead of assigning to the ivar directly. In your case it looks like the area of memory has been reassigned to a gesture recogniser which is showing up in your log statements.