réactiver les NSMutableString
comme ci-dessous:application se bloque lorsque je tente de libérer NSMutableString s'il vous plaît aider à ce
-(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;
}
si je tente de libérer cette chaîne dans la méthode dealloc et essayez d'exécuter l'application mon application se bloque.
s'il vous plaît me donner quelques suggestions comment puis-je libérer ce temp1
Merci à l'avance
Veuillez poster le message d'erreur. – PengOne
à où essayez-vous de le libérer? dans la même fonction? ou à l'extérieur de la fonction? – Maulik
Etes-vous quelque part en train d'écraser 'temp1'? En bref, comme vous pouvez le voir par les commentaires: vous devez fournir * way * plus d'informations et de contexte. – DarkDust