gpt4 book ai didi

ios - 解码 Storyboard 时访问错误导致崩溃

转载 作者:塔克拉玛干 更新时间:2023-11-02 20:04:18 27 4
gpt4 key购买 nike

我收到了 2 份崩溃报告,其中的回溯痕迹似乎表明解码 Storyboard中的图像引用存在问题。在此设备上报告

enter image description here

我无法在运行 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:scale:orientation:] + 114
3 UIKit 0x320d739f +[UIImage imageWithCGImage:scale:orientation:] + 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 instantiateWithOwner:options:] + 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)

任何可能导致此问题的想法或我如何调试它?

最佳答案

我想我找到了问题所在, Storyboard包含此标记:

<image name="pressed" width="1" height="1"/>

而实际图像是 1x80 像素。

大概某些版本的 iOS 信任 Storyboard 并分配不正确大小的缓冲区,而其他版本则进行某种边界检查。

所以解决方案是检查 <resources> storybaord 的 XML 末尾的标记,用于不正确的尺寸。如果有,请删除图像并重新添加。如果这不起作用,请完全删除图像并改为在代码中加载它。

关于ios - 解码 Storyboard 时访问错误导致崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25295226/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com