【问题标题】:UIApplication sendAction:to:from:forEvent: iOS7 no user codeUIApplication sendAction:to:from:forEvent: iOS7 no user code
【发布时间】:2013-10-22 20:22:20
【问题描述】:

我遇到了仅在 iOS7 上发生的崩溃。该应用程序是针对 6.1 sdk 编译的。我自己无法重现这一点,但我可以从崩溃报告中看到它正在发生在某些用户身上。问题是堆栈跟踪中没有用户代码,因此很难追踪:

Exception Type: EXC_BAD_ACCESS Code: KERN_INVALID_ADDRESS at 0x13
0    libobjc.A.dylib     objc_msgSend + 5
1    UIKit   -[UIApplication sendAction:to:from:forEvent:] + 90
2    UIKit   -[UIApplication sendAction:toTarget:fromSender:forEvent:] + 30
3    UIKit   -[UIControl sendAction:to:forEvent:] + 44
4    UIKit   -[UIControl _sendActionsForEvents:withEvent:] + 374
5    UIKit   -[UIControl touchesEnded:withEvent:] + 590
6    UIKit   -[UIWindow _sendTouchesForEvent:] + 528
7    UIKit   -[UIWindow sendEvent:] + 832
8    UIKit   -[UIApplication sendEvent:] + 196
9    UIKit   _UIApplicationHandleEventQueue + 7096
10 ...   CoreFoundation  __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 14
16   UIKit   UIApplicationMain + 1136

我尝试在应用中启用僵尸并执行各种操作,但没有任何标记。

更新

我认为这可能已经演变为 [UIPickerView _updateSelectedRows], EXC_BAD_ACCESS 在 iOS 7.1 下。我会进一步调查。

Thread : Crashed: com.apple.main-thread
0  libobjc.A.dylib                0x39576626 objc_msgSend + 5
1  UIKit                          0x3187b12f -[UIPickerView _updateSelectedRows] + 54
2  UIKit                          0x3187b26f -[UIPickerView didMoveToWindow] + 78
3  UIKit                          0x3160ad37 -[UIView(Internal) _didMoveFromWindow:toWindow:] + 1358
4  UIKit                          0x3160aaa5 -[UIView(Internal) _didMoveFromWindow:toWindow:] + 700
5  UIKit                          0x3160a40d __45-[UIView(Hierarchy) _postMovedFromSuperview:]_block_invoke + 112
6  UIKit                          0x3160a263 -[UIView(Hierarchy) _postMovedFromSuperview:] + 250
7  UIKit                          0x318a2a27 __UIViewWasRemovedFromSuperview + 218
8  UIKit                          0x31609187 -[UIView(Hierarchy) removeFromSuperview] + 270
9  UIKit                          0x316cf26f -[UIPeripheralHost(UIKitInternal) adjustHostViewForTransitionCompletion:] + 310
10 UIKit                          0x31a6ca8b __53-[UIPeripheralHost(UIKitInternal) executeTransition:]_block_invoke1364 + 318
11 UIKit                          0x3164378d -[UIViewAnimationBlockDelegate _didEndBlockAnimation:finished:context:] + 284
12 UIKit                          0x316433d7 -[UIViewAnimationState sendDelegateAnimationDidStop:finished:] + 178
13 UIKit                          0x316432ef -[UIViewAnimationState animationDidStop:finished:] + 66
14 QuartzCore                     0x3128de0b CA::Layer::run_animation_callbacks(void*) + 234
15 libdispatch.dylib              0x39a55d3f _dispatch_client_callout + 22
16 libdispatch.dylib              0x39a586c3 _dispatch_main_queue_callback_4CF + 278
17 CoreFoundation                 0x2eda6679 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 8
18 CoreFoundation                 0x2eda4f45 __CFRunLoopRun + 1308
19 CoreFoundation                 0x2ed0f7a9 CFRunLoopRunSpecific + 524
20 CoreFoundation                 0x2ed0f58b CFRunLoopRunInMode + 106
21 GraphicsServices               0x33c6c6d3 GSEventRunModal + 138
22 UIKit                          0x3166e891 UIApplicationMain + 1136

【问题讨论】:

  • 在测试过程中,您是否已经点击了所有可点击的内容(并在代码中检查了所有操作方法是否实际存在)?
  • 是的,我点击了视图控制器上的所有按钮,我怀疑它正在发生。我无法重现它。
  • 我遇到了同样的问题。请注意,它只发生在 iOS7 设备上。
  • 我还没找到原因。
  • 在我们的例子中,它是由 UIPickerView 被用作自定义 inputView(即替换键盘)引起的,当 ViewController 被更换为另一个时,它被留下并打开。来自自动 resignFirstResponder 的隐藏动画触发了崩溃。

标签: ios iphone objective-c uikit ios7


【解决方案1】:

我的项目的崩溃日志几乎与我们能够跟踪到动画的项目相同。 问题是我们在屏幕上和屏幕外为 UIPickerView 设置了动画。如果拥有 UIPickerView 的 ViewController 在动画期间被弹出并释放。我们通过从动画完成块的超级视图中删除 UIPickerView 解决了这个问题。 [UIView animateWithDuration:0.5f animations:^{ //Set the destination frame of the PickerView } completion:^(BOOL finished) { [self.pickerView removeFromSuperview]; }];

【讨论】:

  • 同样,resignFirstResponder 上的内置动画(在 ViewController 更改期间)对我造成了影响。 removeFromSuperview 在 dealloc 中成功了。
  • 我认为您可能正在做某事,看起来我可以重现它,但方式略有不同,如果我轻弹选择器轮,使其在弹出视图控制器时仍处于动画状态,我得到这次崩溃。我会调查修复。
  • 如果我针对 iOS7 编译它,它不再是可重现的。也许问题只存在于在 iOS7 上运行针对 iOS6 编译的应用程序时。将进行更多测试。
  • @Imran 您是否能够确认问题仅存在于针对 6 编译的应用程序在 7 上运行?
  • @zrxq 我还没有确定,但我认为是这样。一旦我发布了针对 iOS7 编译的更新,我将获得更多统计数据,并将用我的发现更新这篇文章。
【解决方案2】:

我不知道其他崩溃报告工具,但 Crashlytics 包含 CLS_LOG() 宏: http://support.crashlytics.com/knowledgebase/articles/92519-how-do-i-use-logging

在开发过程中,它的行为类似于 NSLog(),但在现场,日志语句包含在崩溃报告中。所以我建议用 CLS_LOG 替换你的调试语句,或者开始在有问题的代码中添加大量捕获用户操作的语句,然后部署你的应用程序的新版本。

(老问题,但我最近遇到了类似的问题,想记录一下。)

【讨论】:

  • 谢谢 Bart,我正在使用 crashlytics 并且有面包屑,所以我知道它发生在哪个屏幕上。不过,将其追踪到该屏幕上的特定用户操作被证明是困难的。
【解决方案3】:

我刚刚收到了与 UIPicker 类似的崩溃。原来我忘记在解除分配之前将委托设置为 nil 。该问题仅在启用断点运行时出现。希望这对其他人有帮助。

【讨论】:

    【解决方案4】:

    尝试从以下位置删除arm64

    Project > BuildSettings > Architectures> Valid Architectures

    并重建您的应用程序。

    您可能还需要将 Build Active Architectures Only 设置为 NO 才能使其工作。

    【讨论】:

    • 这种情况发生在 4s、5 和 5s,所以我不确定这会有所帮助。
    猜你喜欢
    • 2014-04-10
    • 2014-04-16
    • 1970-01-01
    • 1970-01-01
    • 2013-09-27
    • 1970-01-01
    • 2018-08-28
    • 2013-05-22
    • 1970-01-01
    相关资源
    最近更新 更多