如下intialised NSMutableString
幫助:應用程序崩潰時,我嘗試着發佈的NSMutableString請在此
-(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;
}
,如果我嘗試釋放此字符串dealloc方法,並嘗試運行應用程序我的應用程序崩潰。
,請給我一些建議,我怎麼可以釋放這個temp1中提前
感謝
請發佈錯誤信息。 – PengOne
你在哪裏試圖釋放它?在相同的功能?或外面的功能? – Maulik
你是否在某處重寫'temp1'?總之,正如你所看到的評論:你需要提供*方式*更多的信息和上下文。 – DarkDust