intialised NSMutableString as below:
-(NSString*)filterIt:(NSString*)source
{
temp1= [[NSString alloc] initWithString:[source stringByReplacingOccurrencesOfString:@"rlm;" withString:@""]];
//NSString *m_temp;
temp1 = [temp1 stringByReplacingOccurrencesOfString:@"&" withString:@""];
temp1 = [temp1 stringByReplacingOccurrencesOfString:@"#x" withString:@"&#x"];
NSRange range = [temp1 rangeOfString:@"&#x"];
NSRange range1 = NSMakeRange(range.location, 8);
if (range1.location != NSNotFound) {
NSString* temp2 = [temp1 stringByReplacingCharactersInRange:range1 withString:@""];
//[temp1 setString:temp2];
temp1 = temp2;
range = [temp1 rangeOfString:@"&#x"];
while (range.location < [temp1 length]) {
range1 = NSMakeRange(range.location, 8);
temp2 = [temp1 stringByReplacingCharactersInRange:range1 withString:@""];
//[temp1 setString:temp2];
temp1 = temp2;
range = [temp1 rangeOfString:@"&#x"];
}
}
//m_temp = [temp1 mutableCopy];
// [temp1 release];
return temp1;
}
if i try to release this string in dealloc method and try to run the app my app is crashing.
please give me some suggestions that how can i release this temp1
Thanks in advance
you can return your Mutable string as auto release
OR
refer this…