ios - 解码 Storyboard 时出现错误访问崩溃
<p><p>我收到了 2 份崩溃报告,其中回溯似乎表明在 Storyboard 中解码图像引用时出现问题。已在此设备上报告</p>
<p> <img src="/image/YaR31.png" alt="enter image description here"/> </p>
<p>我无法在运行 7.1 的 iPhone 5 或运行 7.0 的模拟器上重现它。我正在使用 7.1 SDK、 Storyboard和 Assets 目录。</p>
<p>第一个日志如下所示:</p>
<pre><code>EXC_BAD_ACCESS KERN_INVALID_ADDRESS at 0x9000000c
Thread : Crashed: com.apple.main-thread
0libobjc.A.dylib0x39c9ab66 objc_msgSend + 5
1CoreGraphics 0x2f9bbc09 CGImageRetain + 16
2UIKit 0x320d742b - + 114
3UIKit 0x320d739f + + 62
4UIKit 0x320e2c4b - + 334
5UIKit 0x320e2af7 - + 38
6UIKit 0x320e2acd - + 44
...
</code></pre>
<p>第二个略有不同:</p>
<pre><code>Thread : Crashed: com.apple.main-thread
0libobjc.A.dylib0x39c9ab66 objc_msgSend + 5
1CoreUI 0x33a7bd0d - + 1052
2CoreUI 0x33a850af - + 170
3CoreUI 0x33a850fd - + 20
4UIKit 0x320e2c01 - + 260
5UIKit 0x320e2af7 - + 38
6UIKit 0x320e2acd - + 44
</code></pre>
<p>从第 6 行开始的其余跟踪对于两个崩溃日志都是通用的。</p>
<pre><code>7UIKit 0x320e2a9b - + 46
8UIKit 0x32427ab1 - + 288
9UIKit 0x324bd1d9 UINibDecoderDecodeObjectForValue + 740
10 UIKit 0x324bceef - + 90
11 UIKit 0x3241b4bd - + 296
12 UIKit 0x324bd1d9 UINibDecoderDecodeObjectForValue + 740
13 UIKit 0x324bd557 UINibDecoderDecodeObjectForValue + 1634
14 UIKit 0x324bceef - + 90
15 UIKit 0x3241d613 - + 594
16 UIKit 0x324bd1d9 UINibDecoderDecodeObjectForValue + 740
17 UIKit 0x324bceef - + 90
18 UIKit 0x32426bf9 - + 112
19 UIKit 0x3242723f - + 42
20 UIKit 0x324bd1d9 UINibDecoderDecodeObjectForValue + 740
21 UIKit 0x324bd179 UINibDecoderDecodeObjectForValue + 644
22 UIKit 0x324bceef - + 90
23 UIKit 0x324263f5 - + 888
24 UIKit 0x323880fb - + 234
25 UIKit 0x321e9b59 - + 92
26 UIKit 0x320cb79d - + 72
27 UIKit 0x320cb719 - + 24
28 UIKit 0x321412a3 - + 58
29 UIKit 0x32141209 - + 76
30 UIKit 0x321b0fb5 - + 4604
31 UIKit 0x321af631 - + 4676
32 FaceInvaders 0x0000e885 - (RSHomeViewController.m:93)
33 UIKit 0x321e40cb - + 1078
34 UIKit 0x32297863 - + 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)
</code></pre>
<p>任何想法可能导致此问题或我如何调试它?</p></p>
<br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
<p><p>我想我找到了问题, Storyboard 包含以下标记:</p>
<pre><code><image name="pressed" width="1" height="1"/>
</code></pre>
<p>而实际图像为 1x80 像素。 </p>
<p>可能某些版本的 iOS 信任 Storyboard 并分配大小不正确的缓冲区,而其他版本则执行某种边界检查。</p>
<p>因此,解决方案是检查 Storyboard XML 末尾的 <code><resources></code> 标记是否有不正确的大小。如果有,请删除图像并重新添加它们。如果这不起作用,请完全删除图像,然后将其加载到代码中。</p></p>
<p style="font-size: 20px;">关于ios - 解码 Storyboard 时出现错误访问崩溃,我们在Stack Overflow上找到一个类似的问题:
<a href="https://stackoverflow.com/questions/25295226/" rel="noreferrer noopener nofollow" style="color: red;">
https://stackoverflow.com/questions/25295226/
</a>
</p>
页:
[1]