Ios6 在iOS 6.1.2中显示UIAlertView时,会发生内存泄漏
*强文本*在iOS 6.1.2中显示UIAlertView时,应用程序将出现如下内存泄漏:Ios6 在iOS 6.1.2中显示UIAlertView时,会发生内存泄漏,ios6,uialertview,memory-leaks,Ios6,Uialertview,Memory Leaks,*强文本*在iOS 6.1.2中显示UIAlertView时,应用程序将出现如下内存泄漏: __NSDictionaryM 1 0x1e5c6000 32 Bytes TextInput __92-[TIResourcePathManager fetchAssetsWithNames:forInputModes:updatingDictionary:continuation:]_block_invoke_0 Malloc 16 Bytes 1 0x1e5d5320
__NSDictionaryM 1 0x1e5c6000 32 Bytes TextInput __92-[TIResourcePathManager fetchAssetsWithNames:forInputModes:updatingDictionary:continuation:]_block_invoke_0
Malloc 16 Bytes 1 0x1e5d5320 16 Bytes TextInput __92-[TIResourcePathManager fetchAssetsWithNames:forInputModes:updatingDictionary:continuation:]_block_invoke_0
代码如下:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
[tableView deselectRowAtIndexPath:indexPath animated:YES];
if (indexPath.row == 1 && indexPath.section == 1) {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Test" message:nil delegate:nil cancelButtonTitle:@"cancel" otherButtonTitles:@"ok", nil];
[alert show];
[alert autorelease];
}
那为什么呢
PS.可能我忘了说这个UIAlertView可能会一个接一个地显示很多次,所以有时候第一次显示UIAlertView是可以的,但是当我尝试几次时,就会发生内存泄漏。替换:
[警报自动释放]代码>
与:
[警报发布]
使用release或autorelease,内存泄漏总是会发生。在viewdilod
中定义UIAlertView
为ClassLevel
和alloc init
,并在didSelectRow
方法中设置文本。为什么这会修复内存泄漏?对不起,也许我忘了说UIAlertView会显示很多次,所以你说的方法不能解决问题。