【问题标题】:IPad Application crashes on deviceiPad 应用程序在设备上崩溃
【发布时间】:2013-01-25 11:36:06
【问题描述】:

我正在为包含UITableView 的iPad 开发一个应用程序。该应用程序在模拟器上运行良好,但在安装并第一次运行时会在设备上崩溃。当我第二次尝试运行该应用程序时,它工作正常。我无法弄清楚问题所在。 相同的代码在 iPhone 上运行良好,但在 iPad 上崩溃。 我正在为表格使用以下代码

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{

static NSString *MythoViewCellIdentifier = @"MythoViewCellIdentifier ";

UITableViewCell *cell=[tableView dequeueReusableCellWithIdentifier:MythoViewCellIdentifier];



if (cell==nil)
{
    cell=[[[UITableViewCell alloc] initWithFrame:CGRectZero] autorelease];        
}

[self getMythoData];


UIImageView *imgLogo =[[UIImageView alloc] initWithFrame:CGRectMake(-1,0,37,35)];
imgLogo.backgroundColor =[UIColor clearColor];
imgLogo.image=[UIImage imageNamed:@"bullet_swastik.png"];
[cell.contentView addSubview:imgLogo];



UITextView *txtDetails =[[UITextView alloc] initWithFrame:CGRectMake(37,34,740,200)];
txtDetails.backgroundColor =[UIColor clearColor];
txtDetails.editable=NO;
txtDetails.font=[UIFont systemFontOfSize:25.0];
[cell.contentView addSubview:txtDetails];



//    adding details to the cell
txtDetails.text = [NSString stringWithFormat:@"%@",[FinalmythoData objectAtIndex:indexPath.row]];
cell.selectionStyle = UITableViewCellSelectionStyleNone;


[txtDetails release];

return cell;
}




 I'm getting the following error

Exception Type:  EXC_BAD_ACCESS (SIGSEGV) Exception Codes:
KERN_INVALID_ADDRESS at 0x00000000 Crashed Thread:  0




    Thanks 

【问题讨论】:

  • 它到底在哪里崩溃了?
  • 哪个会崩溃?调试器应该能够告诉你。如果调试器没有告诉你,你怎么知道它在上面的代码中?
  • 因为应用程序在包含表格的地方崩溃。不包含表格的视图工作正常
  • 数组计数即[FinalmythoData count];

标签: ipad uitableview ios4


【解决方案1】:

该应用在模拟器上运行良好,但在安装并第一次运行时在设备上崩溃。当我尝试第二次运行该应用程序时,它运行良好。

从您的模拟器中删除该应用,清理您的项目,重新构建,然后再次运行该应用。它也有可能在模拟器上崩溃。

【讨论】:

  • 奇怪。然后在控制台或崩溃日志上发布你得到的输出。
  • exe_bad_access(sigsegv)。我得到这个输出
  • 你肯定有更多...堆栈跟踪是什么等,请粘贴在问题的末尾...
【解决方案2】:

确认您的应用没有加载任何可能导致崩溃的繁重数据(图像等)。

在设备上运行您的应用,并使用 Instrument 或任何其他工具确认它没有在内存不足的情况下运行。

【讨论】:

  • 它没有在模拟器和设备上显示任何低内存警告
猜你喜欢
  • 2011-04-08
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多