ios - 如果用户回答传入的 iMessage,WKWebView 会崩溃

标签 ios swift crash wkwebview ios10.3

我的应用程序发生严重崩溃 -

CALayer position contains NaN: [377.833 nan] 

具有以下堆栈 -

Fatal Exception: CALayerInvalidGeometry
0  CoreFoundation                 0x18283afe0 __exceptionPreprocess
1  libobjc.A.dylib                0x18129c538 objc_exception_throw
2  CoreFoundation                 0x18283af28 -[NSException initWithCoder:]
3  QuartzCore                     0x185b50acc CA::Layer::set_position(CA::Vec2<double> const&, bool)
4  QuartzCore                     0x185b50c48 -[CALayer setPosition:]
5  QuartzCore                     0x185b51198 -[CALayer setFrame:]
6  UIKit                          0x1889657a8 -[UIView(Geometry) setFrame:]
7  UIKit                          0x188979364 -[UIImageView _setViewGeometry:forMetric:]
8  UIKit                          0x1889c6c38 -[UIScrollView _adjustScrollerIndicators:alwaysShowingThem:]
9  UIKit                          0x188abfb34 -[UIScrollView(UIScrollViewInternal) _adjustForAutomaticKeyboardInfo:animated:lastAdjustment:]
10 WebKit                         0x18c14af3c -[WKWebView _keyboardChangedWithInfo:adjustScrollView:]
11 CoreFoundation                 0x1827d55f4 __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__
12 CoreFoundation                 0x1827d4d08 _CFXRegistrationPost
13 CoreFoundation                 0x1827d4a84 ___CFXNotificationPost_block_invoke
14 CoreFoundation                 0x1828437a8 -[_CFXNotificationRegistrar find:object:observer:enumerator:]
15 CoreFoundation                 0x18271895c _CFXNotificationPost
16 Foundation                     0x18322a930 -[NSNotificationCenter postNotificationName:object:userInfo:]
17 UIKit                          0x1893500e4 -[UIInputWindowController postStartNotifications:withInfo:]
18 UIKit                          0x189352350 __77-[UIInputWindowController moveFromPlacement:toPlacement:starting:completion:]_block_invoke.907
19 UIKit                          0x188a383cc -[UIInputViewAnimationStyle launchAnimation:afterStarted:completion:forHost:fromCurrentPosition:]
20 UIKit                          0x189351dc8 -[UIInputWindowController moveFromPlacement:toPlacement:starting:completion:]
21 UIKit                          0x1893588b0 -[UIInputWindowController setInputViewSet:]
22 UIKit                          0x189351494 -[UIInputWindowController performOperations:withAnimationStyle:]
23 UIKit                          0x188a30d94 -[UIPeripheralHost(UIKitInternal) setInputViews:animationStyle:]
24 UIKit                          0x1890f7160 -[_UIRemoteKeyboards keyboardChanged:shouldConsiderSnapshottingKeyboard:isLocalEvent:]
25 UIKit                          0x1890f6e8c __37-[_UIRemoteKeyboards

查看用户日志,我发现了一些共同点 -

  1. 所有用户都在一个包含 WKWebView 的 View Controller 中
  2. 所有日志都表明应用程序在崩溃前获得了“applicationWillResignActive”
  3. 堆栈显示键盘已打开,但我们还没有离开那个 View Controller 上的键盘
  4. 所有用户都是 iOS 10.3 +

唯一适合的场景是当应用程序带有可见的 WKWebView 时用户收到 iMessage 并用力触摸它以快速回答。我们测试了这种情况,然后 BOOOM 应用程序崩溃了。

所以我们发现了崩溃,但我们不知道发生了什么。 有没有人遇到过这个问题或知道它可能是什么?

谢谢

最佳答案

不知道对你有没有帮助。我也遇到过 NAN 问题,如果任何值损坏或无效,就会发生这种情况。因此,如果你能找出你的值在哪里被破坏意味着它正在打印 NAN,那么你可以在上面放置 guard 语句。

关于ios - 如果用户回答传入的 iMessage,WKWebView 会崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45163059/

相关文章:

ios - 隐藏状态栏 iPad iOS 7.0

ios - 支持西类牙语的 iOS 语音识别框架

ios - 计算属性生成 "Overriding declaration requires an ' 重写“关键字”错误

swift - 如何在 SwiftUI 列表中重新加载数据?

ios - 导出项目进行本地化时 Xcode 崩溃

unity3d - 使用动态网格时 Unity 完整构建崩溃

ios - 广播结束后如何将RPBroadcastSampleHandler的广播数据存储在iPhone本地文档目录中?

iphone - 继续在后台播放 MPMoviePlayerController 中的电影

ios - 代码有问题,需要帮助

javascript - 为什么这个 HTML 会导致 IE 崩溃?