当我在iphone 5s iOS 7.1或7.1.1上运行程序时,我收到此错误代码,它在iOS模拟器上运行正常。
libobjc.A.dylib`objc_msgSend:
0x1903a01c0: cmp x0, #0
0x1903a01c4: b.le 0x1903a0230 ; objc_msgSend + 112
0x1903a01c8: ldr x13, [x0, 0]
0x1903a01cc: and x9, x13, #0x1fffffff8
0x1903a01d0: ldp x10, x11, [x9, #16] // this line gives an error
0x1903a01d4: and w12, w1, w11
0x1903a01d8: add x12, x10, x12, lsl #4
错误是:线程10:EXC_BAD_ACCESS(代码= 1,地址= 0x1a15cbeb8)
这是返回错误但仅在离线时返回的代码。我使用coredata来保存值。
if([[purchased objectAtIndex:locator]boolValue])
{
NSAttributedString *theAttributedString;
theAttributedString = [[NSAttributedString alloc] initWithString:cellLabel.text
attributes:@{NSStrikethroughStyleAttributeName:
[NSNumber numberWithInteger:NSUnderlineStyleSingle]}];
cellLabel.attributedText = theAttributedString;
[cellLabel setTextColor:[UIColor colorWithRed:163/255.0f green:135/255.0f blue:138/255.0f alpha:1.0f]];
[cellLabel1 setTextColor:[UIColor colorWithRed:189/255.0f green:167/255.0f blue:169/255.0f alpha:1.0f]];
imgView.image = [UIImage imageNamed: @"checkbox-checked.png"];
}
else
{
[cellLabel setTextColor:[UIColor colorWithRed:60/255.0f green:0/255.0f blue:0/255.0f alpha:1.0f]];
[cellLabel1 setTextColor:[UIColor colorWithRed:80/255.0f green:37/255.0f blue:37/255.0f alpha:1.0f]];
imgView.image = [UIImage imageNamed: @"checkbox.png"];
}
我发现了程序崩溃的原因。这是一个小家伙。
cellLabel.attributedText = theAttributedString;
为什么它可以在线运行,但是当你离线时我就超出了它。任何人都可以解释一下吗?
这是我启用僵尸时的结果。
[NSStringDrawingTextStorage textContainerForAttributedString:containerSize:lineFragmentPadding:]: message sent to deallocated instance 0x170303690
(lldb)