objective c - app is crashing when i try to release nsmutablestring please help on this -



objective c - app is crashing when i try to release nsmutablestring please help on this -

intialised nsmutablestring 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]; homecoming temp1; }

if seek release string in dealloc method , seek run app app crashing.

please give me suggestions how can release temp1

thanks in advance

you can homecoming mutable string auto release

or

refer this...

objective-c ios memory-management nsmutablestring

Comments

Popular posts from this blog

iphone - Dismissing a UIAlertView -

c# - Can ProtoBuf-Net deserialize to a flat class? -

javascript - Change element in each JQuery tab to dynamically generated colors -