【发布时间】:2009-06-30 15:00:19
【问题描述】:
我有一个运行良好的设备/调试版本。当我构建发布并分发到设备上时,我收到此错误:
*** 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);
这真的没有任何意义。
【问题讨论】:
标签: iphone xcode iphone-sdk-3.0 build