我收到了 2 份崩溃报告,其中回溯似乎表明在 Storyboard 中解码图像引用时出现问题。已在此设备上报告
我无法在运行 7.1 的 iPhone 5 或运行 7.0 的模拟器上重现它。我正在使用 7.1 SDK、 Storyboard和 Assets 目录。
第一个日志如下所示:
EXC_BAD_ACCESS KERN_INVALID_ADDRESS at 0x9000000c
Thread : Crashed: com.apple.main-thread
0 libobjc.A.dylib 0x39c9ab66 objc_msgSend + 5
1 CoreGraphics 0x2f9bbc09 CGImageRetain + 16
2 UIKit 0x320d742b -[UIImage initWithCGImage:scalerientation:] + 114
3 UIKit 0x320d739f +[UIImage imageWithCGImage:scalerientation:] + 62
4 UIKit 0x320e2c4b -[_UIAssetManager imageNamed:scale:idiom:subtype:cachingOptions:] + 334
5 UIKit 0x320e2af7 -[_UIAssetManager imageNamed:scale:idiom:subtype:] + 38
6 UIKit 0x320e2acd -[_UIAssetManager imageNamed:idiom:subtype:] + 44
...
第二个略有不同:
Thread : Crashed: com.apple.main-thread
0 libobjc.A.dylib 0x39c9ab66 objc_msgSend + 5
1 CoreUI 0x33a7bd0d -[CUIStructuredThemeStore renditionWithKey:] + 1052
2 CoreUI 0x33a850af -[CUINamedImage _renditionForSpecificKey:] + 170
3 CoreUI 0x33a850fd -[CUINamedImage image] + 20
4 UIKit 0x320e2c01 -[_UIAssetManager imageNamed:scale:idiom:subtype:cachingOptions:] + 260
5 UIKit 0x320e2af7 -[_UIAssetManager imageNamed:scale:idiom:subtype:] + 38
6 UIKit 0x320e2acd -[_UIAssetManager imageNamed:idiom:subtype:] + 44
从第 6 行开始的其余跟踪对于两个崩溃日志都是通用的。
7 UIKit 0x320e2a9b -[_UIAssetManager imageNamed:idiom:] + 46
8 UIKit 0x32427ab1 -[UIImageNibPlaceholder initWithCoder:] + 288
9 UIKit 0x324bd1d9 UINibDecoderDecodeObjectForValue + 740
10 UIKit 0x324bceef -[UINibDecoder decodeObjectForKey:] + 90
11 UIKit 0x3241b4bd -[UIButtonContent initWithCoder:] + 296
12 UIKit 0x324bd1d9 UINibDecoderDecodeObjectForValue + 740
13 UIKit 0x324bd557 UINibDecoderDecodeObjectForValue + 1634
14 UIKit 0x324bceef -[UINibDecoder decodeObjectForKey:] + 90
15 UIKit 0x3241d613 -[UIButton initWithCoder:] + 594
16 UIKit 0x324bd1d9 UINibDecoderDecodeObjectForValue + 740
17 UIKit 0x324bceef -[UINibDecoder decodeObjectForKey:] + 90
18 UIKit 0x32426bf9 -[UIRuntimeConnection initWithCoder:] + 112
19 UIKit 0x3242723f -[UIRuntimeEventConnection initWithCoder:] + 42
20 UIKit 0x324bd1d9 UINibDecoderDecodeObjectForValue + 740
21 UIKit 0x324bd179 UINibDecoderDecodeObjectForValue + 644
22 UIKit 0x324bceef -[UINibDecoder decodeObjectForKey:] + 90
23 UIKit 0x324263f5 -[UINib instantiateWithOwnerptions:] + 888
24 UIKit 0x323880fb -[UIViewController _loadViewFromNibNamed:bundle:] + 234
25 UIKit 0x321e9b59 -[UIViewController loadView] + 92
26 UIKit 0x320cb79d -[UIViewController loadViewIfRequired] + 72
27 UIKit 0x320cb719 -[UIViewController view] + 24
28 UIKit 0x321412a3 -[UIViewController viewControllerForRotation] + 58
29 UIKit 0x32141209 -[UIViewController _visibleView] + 76
30 UIKit 0x321b0fb5 -[UIWindowController transition:fromViewController:toViewController:target:didEndSelector:animation:] + 4604
31 UIKit 0x321af631 -[UIViewController presentViewController:withTransition:completion:] + 4676
32 FaceInvaders 0x0000e885 -[RSHomeViewController tableView:didSelectRowAtIndexPath:] (RSHomeViewController.m:93)
33 UIKit 0x321e40cb -[UITableView _selectRowAtIndexPath:animated:scrollPosition:notifyDelegate:] + 1078
34 UIKit 0x32297863 -[UITableView _userSelectRowAtPendingSelectionIndexPath:] + 214
35 UIKit 0x32147781 _applyBlockToCFArrayCopiedToStack + 316
36 UIKit 0x320bf7bb _afterCACommitHandler + 430
37 CoreFoundation 0x2f90df69 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 20
38 CoreFoundation 0x2f90b8f7 __CFRunLoopDoObservers + 286
39 CoreFoundation 0x2f90bc43 __CFRunLoopRun + 738
40 CoreFoundation 0x2f876471 CFRunLoopRunSpecific + 524
41 CoreFoundation 0x2f876253 CFRunLoopRunInMode + 106
42 GraphicsServices 0x345b02eb GSEventRunModal + 138
43 UIKit 0x3212b845 UIApplicationMain + 1136
44 FaceInvaders 0x00017fa1 main (main.m:16)
任何想法可能导致此问题或我如何调试它?
Best Answer-推荐答案 strong>
我想我找到了问题, Storyboard 包含以下标记:
<image name="pressed" width="1" height="1"/>
而实际图像为 1x80 像素。
可能某些版本的 iOS 信任 Storyboard 并分配大小不正确的缓冲区,而其他版本则执行某种边界检查。
因此,解决方案是检查 Storyboard XML 末尾的 标记是否有不正确的大小。如果有,请删除图像并重新添加它们。如果这不起作用,请完全删除图像,然后将其加载到代码中。
关于ios - 解码 Storyboard 时出现错误访问崩溃,我们在Stack Overflow上找到一个类似的问题:
https://stackoverflow.com/questions/25295226/
|