菜鸟教程小白 发表于 2022-12-12 09:36:00

ios - 向左滑动时,iOS 7 上的表格 View 崩溃


                                            <p><p>每当我在单元格上向左滑动时,我的应用程序就会崩溃,这就是我得到的结果</p>

<pre><code>-: unrecognized selector sent to instance 0x166a1960
-: unrecognized selector sent to instance 0x166a1960
Stack Trace: (
    0   CoreFoundation                      0x2fc08f23 &lt;redacted&gt; + 154
    1   libobjc.A.dylib                     0x3a39fce7 objc_exception_throw + 38
    2   CoreFoundation                      0x2fc0c837 &lt;redacted&gt; + 202
    3   CoreFoundation                      0x2fc0b137 &lt;redacted&gt; + 706
    4   CoreFoundation                      0x2fb5a098 _CF_forwarding_prep_0 + 24
    5   UIKit                               0x3262ef91 &lt;redacted&gt; + 184
    6   UIKit                               0x325be3f5 &lt;redacted&gt; + 816
    7   UIKit                               0x32468a21 &lt;redacted&gt; + 148
    8   UIKit                               0x325ce0cf &lt;redacted&gt; + 78
    9   UIKit                               0x324681eb &lt;redacted&gt; + 458
    10UIKit                               0x32467c4b &lt;redacted&gt; + 666
    11UIKit                               0x3243ce75 &lt;redacted&gt; + 196
    12UIKit                               0x3243b541 &lt;redacted&gt; + 7120
    13CoreFoundation                      0x2fbd3fef &lt;redacted&gt; + 14
    14CoreFoundation                      0x2fbd34b7 &lt;redacted&gt; + 206
    15CoreFoundation                      0x2fbd1ca7 &lt;redacted&gt; + 630
    16CoreFoundation                      0x2fb3c769 CFRunLoopRunSpecific + 524
    17CoreFoundation                      0x2fb3c54b CFRunLoopRunInMode + 106
    18GraphicsServices                  0x34aa96d3 GSEventRunModal + 138
    19UIKit                               0x3249b891 UIApplicationMain + 1136
    20Event Receiver                      0x000c3849 main + 116
    21libdyld.dylib                     0x3a89dab7 &lt;redacted&gt; + 2
)
</code></pre>

<p>我尝试为 - 添加符号断点,但没有显示哪段代码发送了该选择器</p>

<p><strong>更新</strong>:这次我使用了模拟器,并试图让应用程序崩溃,我现在得到了这个:</p>

<pre><code>*** Terminating app due to uncaught exception &#39;NSInvalidArgumentException&#39;, reason: &#39;-: unrecognized selector sent to instance 0x8e46570&#39;
*** First throw call stack:
(
    0   CoreFoundation                      0x01ad91e4 __exceptionPreprocess + 180
    1   libobjc.A.dylib                     0x018588e5 objc_exception_throw + 44
    2   CoreFoundation                      0x01b76243 - + 275
    3   CoreFoundation                      0x01ac950b ___forwarding___ + 1019
    4   CoreFoundation                      0x01ac90ee _CF_forwarding_prep_0 + 14
    5   UIKit                               0x00785f7a - + 203
    6   UIKit                               0x008b5466 - + 1309
    7   UIKit                               0x008b1d89 - + 171
    8   UIKit                               0x008e39d7 - + 142
    9   UIKit                               0x0099792a - + 89
    10UIKit                               0x005597d8 - + 649
    11UIKit                               0x0055a971 - + 1021
    12UIKit                               0x0052c5f2 - + 242
    13UIKit                               0x00516353 _UIApplicationHandleEventQueue + 11455
    14CoreFoundation                      0x01a6277f __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15
    15CoreFoundation                      0x01a6210b __CFRunLoopDoSources0 + 235
    16CoreFoundation                      0x01a7f1ae __CFRunLoopRun + 910
    17CoreFoundation                      0x01a7e9d3 CFRunLoopRunSpecific + 467
    18CoreFoundation                      0x01a7e7eb CFRunLoopRunInMode + 123
    19GraphicsServices                  0x03dba5ee GSEventRunModal + 192
    20GraphicsServices                  0x03dba42b GSEventRun + 104
    21UIKit                               0x00518f9b UIApplicationMain + 1225
    22Event Receiver                      0x000056cd main + 141
    23libdyld.dylib                     0x026a5701 start + 1
)
</code></pre></p>
                                    <br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
                                            <p><p>通过对单元格应用一些颜色,我看到当我从附件 View 中滑动单元格时,应用程序崩溃了</p>

<p> <img src="/image/DYOsU.jpg" alt="enter image description here"/> </p>

<p> <img src="/image/uHJNX.png" width="300" height="600"/> </p>

<hr/>

<p>解决方法是在 tableView:cellForRowAtIndexPath: 中将附件类型设置为 UITableViewCellAccessoryNone:</p>

<pre><code>cell.accessoryType = UITableViewCellAccessoryNone;
</code></pre>

<p> <img src="/image/W7YUM.png" width="300" height="600"/> </p>

<hr/>

<p><strong>引用:</strong>
-如何使用操作制作可滑动的表格 View 单元格 -ScrollView 不会发疯 <a href="http://www.raywenderlich.com/62435/make-swipeable-table-view-cell-actions-without-going-nuts-scroll-views" rel="noreferrer noopener nofollow">here</a> </p>

<p>-仔细查看表格 View 单元格<a href="https://developer.apple.com/library/ios/documentation/userexperience/conceptual/tableview_iphone/TableViewCells/TableViewCells.html" rel="noreferrer noopener nofollow">here</a> </p></p>
                                   
                                                <p style="font-size: 20px;">关于ios - 向左滑动时,iOS 7 上的表格 View 崩溃,我们在Stack Overflow上找到一个类似的问题:
                                                        <a href="https://stackoverflow.com/questions/23374829/" rel="noreferrer noopener nofollow" style="color: red;">
                                                                https://stackoverflow.com/questions/23374829/
                                                        </a>
                                                </p>
                                       
页: [1]
查看完整版本: ios - 向左滑动时,iOS 7 上的表格 View 崩溃