嗨,大家好可有人请告知如何治愈内存泄漏下面的代码中内存泄漏,而使用的NSMutableArray
我已经尝试了关于释放和自动释放的每一个组合我能想到但每次要么时间的应用程序崩溃或泄漏保留
- (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component{
//get refereance to the textfield
UITextField *currentTextField = (UITextField*)[self.view viewWithTag:200];
//check which picker
if(pickerView.tag ==1)
{
// Only calls the following code if component "0" has changed.
if (component == 0) {
// Sets the global integer "component0Row" to the currently selected row of component "0"
component0Row = row;
// Loads the new values for the selector into a new array in order to reload the data.
newValues = [[NSMutableArray alloc] initWithArray:[pickerData objectForKey:[selectorKeys objectAtIndex:component0Row]]];
currentValues = newValues;
// Reloads the data of component "1".
[pickerView reloadComponent:1];
}
//run the selector logic
[self textFieldDidEndEditing:currentTextField];
}
希望有人可以告诉
千恩万谢
嗨benzoda感谢您的建议,但我已经厌倦此版本之前,现在再次和应用程序崩溃与exc-bad-access当我滚动选择器它现在让我疯狂 – superllanboy
你问了一个泄漏。这些答案会堵塞你的泄漏。崩溃是另一个问题。谷歌的指示,并在'objc_exception_throw'上放置一个断点,这样你就可以找出坏指针是什么。然后问一个新的问题,如果你不能*出*。 – benzado
如果我采用你建议的用于插入漏洞的代码,崩溃会发生,可能是因为插入的漏洞可能导致另一部分代码崩溃?我真的不明白这一点,所以希望你可以详细说明并解释谢谢 – superllanboy