我有3個視圖控制器讓VC1-> VC2-> VC3通過導航控制器。在VC3中,我嘗試再次跳回到VC1 &,再次通過進程VC1-> VC2-> VC3進行導航。雖然從一個視圖控制器要等下面的代碼是用來三個視圖控制器的10次跳閘後UI被阻塞
-(void)NEXTButtonpressed:(id)sender
{
PaymentVC *paymentview=[[PaymentVC alloc] initWithNibName:@"PaymentVC" bundle:Nil];
if (![[[OSEsingleton sharedInstance].globaldictionary objectForKey:@"status"]boolValue])
{
if ([self validationforsupportersname])
{
[self.navigationController pushViewController:paymentview animated:YES];
}
}
else
{
[self.navigationController pushViewController:paymentview animated:YES];
}
}
10次後,我的UI被凍結,有時我收到以下錯誤。
1)
levanApp(852,0x366279dc) malloc: *** mach_vm_map(size=65536) failed (error code=3)
*** error: can't allocate region
*** set a breakpoint in malloc_error_break to debug
(Occuring Frequently)
2)
levanApp[852] <Error>: ImageIO: PNG insufficient memory
(Occuring Rarely)
有時應用崩潰並且示出imageWothocontentofFile
呼叫在下面的代碼58%的CPU時間
-(UIImage *)returnlogoimgae:(NSString *)imagename
{
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *path = [NSString stringWithFormat:@"%@.png",imagename];
NSString *getImagePath = [documentsDirectory stringByAppendingPathComponent:path];
NSLog(@"%@",getImagePath);
UIImage *image=[UIImage imageWithContentsOfFile:getImagePath];
return image;
}
我已經使用時間曲線爲了它。在一個方法調用[_coredata parseTheCoreData:results]
我得到100%的CPU時間。我該如何處理這個問題?
可以請你告訴我你的代碼時,點擊或採取任何行動來推動控制器。 –
請查看我更新的代碼nextButtonPressed。 – MuraliMohan
看起來你正在耗盡內存 - 你是否也在爲此進行配置?如果這個假設是正確的,你將需要發佈更多的代碼,因爲你可能會有一個保留週期 – dogsgod