0

在使用我的 ipad 应用程序时,我收到了一系列警告(3 月 18 日 11:18:06 内核 [0]:IOSurface 警告:缓冲区分配失败。980 x 606 fmt:42475241 大小:2387968 字节)超过 50 次只需 20 秒,应用程序就崩溃了,报告如下:

Mar 18 11:18:35  ReportCrash[1428] <Notice>: Formulating crash report for process eDetail[1353]
Mar 18 11:18:35  ReportCrash[1428] <Error>: libMobileGestalt copySystemVersionDictionaryValue: Could not lookup ReleaseType from system version dictionary
Mar 18 11:18:35  ReportCrash[1428] <Notice>: Saved crashreport to /var/mobile/Library/Logs/CrashReporter/eDetail_2013-03-19-111833_iPad.plist using uid: 0  gid: 0, synthetic_euid: 501 egid: 0
Mar 18 11:18:35  com.apple.launchd[1] <Warning>: (UIKitApplication:com.****.profile***[0x1024]) Job appears to have crashed: Segmentation fault: 11
Mar 18 11:18:35  backboardd[26] <Warning>: Application 'UIKitApplication:com.****.profile***[0x1024]' exited abnormally with signal 11: Segmentation fault: 11

任何人都可以帮助我找出这个问题的根本原因并解决它。

编辑:在这个代码点上也显示了警告:

NSString *docsDir;
NSArray *dirPaths;

filemgr = [NSFileManager defaultManager];
// Get the documents directory


dirPaths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);    
docsDir = [dirPaths objectAtIndex:0];

// Build the path to the data file
dataFilePath = [[NSString alloc] initWithString: [docsDir stringByAppendingPathComponent: @"data.archive"]];

// Check if the file already exists
if ([filemgr fileExistsAtPath: dataFilePath]){

    NSMutableDictionary *dataDict = [NSKeyedUnarchiver unarchiveObjectWithFile: dataFilePath];
    if ([dataDict count] != 0) {
        m_cUserName.text = [dataDict objectForKey:@"UserName"];
        m_cPassword.text = @"";
        if([[dataDict objectForKey:@"AccountType"] isEqualToString:@"Specialty"]){
            m_cBgImage.image = [UIImage imageNamed:@"specialityloginbg.png"];
        }else {
            m_cBgImage.image = [UIImage imageNamed:@"infusionloginbg"];
        }
    }   
}

希望这能有所帮助。

4

1 回答 1

2

好的,最后我得到了原因和解决方案。由于内存的过度使用,操作系统无法为渲染图像分配缓冲区。在收到一系列此警告后,App 崩溃了。我在完成目的后立即减少了内存的使用并释放了对象,我完全摆脱了这个警告。

于 2013-03-25T13:37:38.820 回答