我有一个设备/调试版本工作正常。当我建立发布和分发到设备上,我得到这个错误:为什么版本构建失败并且不能调试?
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[UILabel setWidth:]: unrecognized selector sent to instance 0x1605a0'
它在发生的cellForRowAtIndexPath:
cell.videoName.width = 163.0;
,其中电池是一个自定义的UITableViewCell和videoName是一个UILabel。为什么调试版本能正常工作并且发布失败?分发版本也失败。所有的都设置为Base SDK == iPhone OS 3.0。
为了得到一个发布版本手机上,我只是改变了我的代码签名给开发商。我也尝试过通过iTunes进行发行版,但是它失败了,发生了同样的错误。
---编辑---
我加载的细胞是这样的:
static NSString * QuestionCellIdentifier = @"QuestionCellIdentifier";
TopicCellController *cell = (TopicCellController *)[tableView dequeueReusableCellWithIdentifier:QuestionCellIdentifier];
if(cell == nil){
NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"TopicCell" owner:self options:nil];
cell = [nib objectAtIndex:0];
}
cell.videoName.width = 163.0;
在运行时,细胞是自定义类型和videoName不为零。如果我删除最后一行(设置宽度),它工作正常。
---编辑:新发现---
我发现,而不是调用宽度,我能做到这一点,它在发布工作:
cell.videoName.frame = CGRectMake(10, 10, 100, 30);
那真的没有任何意义。
我编辑过一些额外的信息来解决您的意见。谢谢。 – 4thSpace 2009-06-30 15:30:28