- r - 以节省内存的方式增长 data.frame
- ruby-on-rails - ruby/ruby on rails 内存泄漏检测
- android - 无法解析导入android.support.v7.app
- UNIX 域套接字与共享内存(映射文件)
我无法理解我收到的 UIKit 崩溃报告:
有没有办法找出是哪一行代码导致的:
Crashed: com.apple.main-thread
0 UIKit 0x195694264 __56-[UIPresentationController runTransitionForCurrentState]_block_invoke + 444
1 UIKit 0x1955d0950 _runAfterCACommitDeferredBlocks + 292
2 UIKit 0x1955c29ec _cleanUpAfterCAFlushAndRunDeferredBlocks + 528
3 UIKit 0x195336648 _afterCACommitHandler + 132
4 CoreFoundation 0x18f1c09a8 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 32
5 CoreFoundation 0x18f1be630 __CFRunLoopDoObservers + 372
6 CoreFoundation 0x18f1bea7c __CFRunLoopRun + 956
7 CoreFoundation 0x18f0eeda4 CFRunLoopRunSpecific + 424
8 GraphicsServices 0x190b58074 GSEventRunModal + 100
9 UIKit 0x1953a9058 UIApplicationMain + 208
10 FlexConnect 0x1001b48c8 main (AppDelegate.swift:20)
11 libdyld.dylib 0x18e0fd59c start + 4
错误本身是:
崩溃:com.apple.main-thread
EXC_BAD_ACCESS KERN_INVALID_ADDRESS 0x0000000000000010
编辑:
根据以下答案,我想知道是否建议使用:
func topMostController() -> UIViewController {
var topController: UIViewController = UIApplication.sharedApplication().keyWindow!.rootViewController!
while (topController.presentedViewController != nil) {
topController = topController.presentedViewController!
}
return topController
}
总是打电话
let topVC = topMostController().dismiss(animated: true, completion: nil)
在我的应用程序中我目前有 self.dismiss(animated: true, completion: nil) 的任何地方?
这是必要的检查,还是我如何确定 self.dismiss 哪里有问题?
一些示例解雇:
@IBAction func returnToDash(_ sender: UIButton) {
self.dismiss(animated: true, completion: nil)
}
let pending = UIAlertController(title: "\n\n\n\(title)", message: nil, preferredStyle: .alert)
displayActivityAlertWithCompletion2(ViewController: self, pending: pending){_ in
Helper_StatusCheck.doSync(_cleanSync: false){
Prefs.is_Syncing = false
DispatchQueue.main.async {
pending.dismiss(animated: true){
Toast(text: "Upload sync completed").show()
self.dismiss(animated: true, completion: nil)
}
}
}
}
displayActivityAlertWithCompletion2 看起来像:
public func displayActivityAlertWithCompletion2(ViewController: UIViewController, pending: UIAlertController, completionHandler: @escaping ()->())
{
//let pending = UIAlertController(title: "\n\n\n"+title, message: nil, preferredStyle: .alert)
//create an activity indicator
let indicator = UIActivityIndicatorView(frame: pending.view.bounds)
indicator.autoresizingMask = [.flexibleWidth, .flexibleHeight]
indicator.color = UIColor(rgba: Palette.loadingColour)
//add the activity indicator as a subview of the alert controller's view
pending.view.addSubview(indicator)
indicator.isUserInteractionEnabled = false
// required otherwise if there buttons in the UIAlertController you will not be able to press them
indicator.startAnimating()
ViewController.present(pending, animated: true, completion: completionHandler)
}
编辑 2:
我的应用程序中的一些示例弹出方法:
@IBAction func search(_ sender: UIButton) {
if let popView = UIStoryboard(name: "AssetCommon", bundle: nil).instantiateViewController(withIdentifier: "searchPop") as? searchPopVC {
popView.delegate = self
popView.modalPresentationStyle = .popover;
popView.popoverPresentationController?.delegate = self
popView.popoverPresentationController?.barButtonItem = searchButton
popView.popoverPresentationController?.permittedArrowDirections = .any
popView.preferredContentSize = CGSize(width: 300, height: 70)
self.present(popView, animated: true, completion: nil)
}
}
和搜索弹出:
class searchPopVC: UIViewController
{
@IBOutlet weak var searchBar: UISearchBar!
weak var delegate: SearchPopDelegate?
override func viewDidLoad()
{
super.viewDidLoad()
searchBar.delegate = self;
}
override func didReceiveMemoryWarning()
{
super.didReceiveMemoryWarning()
}
@IBAction func performSearch(_ sender: UIButton)
{
let term = searchBar.text ?? "";
delegate?.performSearch(with: term)
self.dismiss(animated: true, completion: nil);
}
}
extension searchPopVC: UISearchBarDelegate
{
func searchBarSearchButtonClicked(_ searchBar: UISearchBar) {
let term = searchBar.text ?? "";
delegate?.performSearch(with: term);
self.dismiss(animated: true, completion: nil)
}
}
最佳答案
您将无法从这次崩溃中找到代码行。但是,当您用来调用 dismiss(animated:completion:)
的 View Controller 在动画完成之前从 View 层次结构中移除时,就会发生此崩溃。
根据您的代码设置方式,您可以尝试请求更高层的 View Controller 来调用解雇。另一种解决方案可能是将 View Controller 保留在属性中,直到您确定使用它为止。
编辑:1/5/18
作为对评论的回应,这里有一个示例,说明如何为记录事件和取消事件的 View Controller 创建一个函数。
extension UIViewController {
func dismissAndLog(animated: Bool, completion: (() -> ())? = nil) {
// Here are two examples of how your view controller can be identified.
// let id = title
let id = String(describing: type(of: self))
CLSLogv("Dismissed View Controller: %@", getVaList([id]))
dismiss(animated: animated, completion: completion)
}
}
我对 Crashlytics 或其 API 并不完全熟悉,因此如果此日志记录给您带来问题,您可以查看这些链接。
另外我不知道他们是如何向你提供数据的,所以我无法向你解释解析它的最佳方式。但是,当然可以将时间戳成功地用作最终解决方案。您也可以尝试通过电子邮件向他们的支持人员发送电子邮件,询问将这些日志映射到崩溃的最佳方式。
关于swift - 了解 crashlytics UIKit 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46663611/
我有一个具有两种构建类型的 Android 应用程序。一个是Debug,另一个是Release 我面临的问题是我的Debug Build 正在发送崩溃向 Crashlytics 报告,我的 Relea
我正在使用 Fabric,之前我没有遇到任何问题,直到我添加了一个新的 Target,这是“今日扩展”所必需的。 "Multiple Targets" of type "Today Extension
我在我的应用程序上设置了 firebase 的 crashlytics。 但是在gradle构建的时候出现如下错误 我尝试过的事情: 为了解决这个问题,我尝试过更换版本,没有解决。 我更改了存储库的顺
以前,我们曾经依赖 Firebase 控制台获取崩溃报告。它运行良好,但随后 Google 还宣布通过 Crashlytics 正式支持崩溃报告,我们继续进行 Crashlytics 集成。唯一的问题
我使用 Crashlytics 的 Beta 版部署了 android 应用程序并向用户发送了邀请,用户在他的 android 设备中打开了邀请并看到以下消息: “在您的设备上打开邀请电子邮件以开始注
在我的 Android 应用中安装“Crashlytics”时,它会自动安装“Answers”。我只想安装“Crashlytics”并希望禁用“答案”。有谁知道这是怎么做到的吗? build.grad
我们有一个应用程序已经在 fabrics 上注册,该帐户报告崩溃没有任何问题,但现在我们想更改此应用程序的帐户以发布新版本,但它没有得到更改,即应用程序在新帐户而不是新版本上不可见应用程序的旧帐户可见
根据 documentation 有两种登录 Crashlytics 的方法. Crashlytics.log(int priority, String tag, String msg); 除了写入下
我得到了新项目。实际上,这是使用 Objective-C 的 iOS 旧游戏项目。我只是继续这个项目。 我在项目中看到了这段相关代码。 运行脚本: ./Crashlytics.framework/ru
我们正在使用react-native,并设置了一个快速文件来构建和部署iOS和Android测试版。如果我们构建并部署 iOS 测试版,一切都会好起来的。如果我们构建并部署 Android 测试版,一
在更新我的 Android 应用程序期间,我更新了所有依赖项。当我测试发布版本时,我收到以下错误: E/CrashlyticsCore:缺少 Crashlytics 构建 ID。当应用程序的构建配置中
以前的 Fabric SDK 允许这样的检查 if (Fabric.isInitialized()) { crashSetParam(CrashParameters.ROOT_NODE, no
有没有人成功地将 crashlytics 与 github 集成,我不确定这个问题在这里有多大的相关性? 我已经在 github 上安装了 android 应用程序,并且我在应用程序中正确集成了 cr
使用 Crashlytics 的人是否能够为 Mac Catalyst 编译 iOS 应用程序? 我尝试为 Catalyst 构建一款 iOS 应用程序,但出现以下错误: ld: in /Users/
我在 gradle 中有两种构建风格,但由于某种原因,每当我将以下标志更改为 false 时,我都会收到标题错误消息: ext.enableCrashlytics = false 错误本身完成如下:
我在 Google Play Store 上有一个使用 Fabric Crashlytics 的应用程序和 Fabric SDK 目前不被接受,并将继续报告您的应用程序问题,直到 2020 年 11
我尝试按照官方升级文档进行操作,但是在我更改了 gradle 文件中的每个相关行后,我得到了这个错误: A problem occurred evaluating project ':app'. Fa
使用 Firebase Crashlytics SDK,文档说明了如何 force a crash 但是,在该行中: Crashlytics.getInstance().crash(); Crashl
Firebase Crashlytics 符号上传不适用于 Android 应用程序包 (AAB) 按照此处的说明完成设置:https://firebase.google.com/docs/crash
我有一个应用程序将崩溃和非致命事件记录到 Fabric Crashlytics,并使用 Firebase Analytics 记录分析事件。 我想从 Fabric Crashlytics 迁移到 Fi
我是一名优秀的程序员,十分优秀!