Ios 显示未发生的调用堆栈的崩溃日志
下面是.crash文件的一部分Ios 显示未发生的调用堆栈的崩溃日志,ios,swift,realm,Ios,Swift,Realm,下面是.crash文件的一部分 Thread 0 name: Thread 0 Crashed: 0 libsystem_kernel.dylib 0x000000018181d2ec __pthread_kill + 8 1 libsystem_pthread.dylib 0x00000001819be288 pthread_kill$VARIANT$mp + 376 (pthread.c:1484) 2 libsystem_c.dylib
Thread 0 name:
Thread 0 Crashed:
0 libsystem_kernel.dylib 0x000000018181d2ec __pthread_kill + 8
1 libsystem_pthread.dylib 0x00000001819be288 pthread_kill$VARIANT$mp + 376 (pthread.c:1484)
2 libsystem_c.dylib 0x000000018178bd0c abort + 140 (abort.c:91)
3 libc++abi.dylib 0x0000000180f272c8 abort_message + 132 (abort_message.cpp:75)
4 libc++abi.dylib 0x0000000180f27470 default_terminate_handler() + 304 (cxa_default_handlers.cpp:68)
5 libobjc.A.dylib 0x0000000180f508d4 _objc_terminate() + 124 (objc-exception.mm:657)
6 libc++abi.dylib 0x0000000180f4137c std::__terminate(void (*)()) + 16 (cxa_handlers.cpp:66)
7 libc++abi.dylib 0x0000000180f40ccc __cxa_throw + 132 (cxa_exception.cpp:130)
8 libobjc.A.dylib 0x0000000180f50720 objc_exception_throw + 364 (objc-exception.mm:547)
9 Realm 0x00000001029405f0 -[RLMRealm verifyThread] + 80 (RLMRealm.mm:152)
10 Realm 0x00000001028c8a78 invocation function for block in objc_object* (anonymous namespace)::makeBoxedGetter<realm::StringData>(unsigned long) + 80 (RLMObject_Private.hpp:47)
11 My App 0x00000001025ab94c CallerDetailViewController.getTitleOfCaller() + 64 (CallerDetailViewController.swift:1864)
12 My App 0x00000001025b4db8 specialized CallerDetailViewController.displayUnableToMarkAsNotSpamErrorMessage(error:) + 48
13 My App 0x00000001025b5684 specialized closure #2 in closure #2 in CallerDetailViewController.blockNumber() + 100 (CallerDetailViewController.swift:0)
14 My App 0x00000001025b809c partial apply for closure #2 in closure #2 in CallerDetailViewController.blockNumber() + 176 (CallerDetailViewController.swift:0)
15 My App 0x0000000102629b7c thunk for @callee_owned () -> () + 36 (Toast.swift:0)
16 libdispatch.dylib 0x0000000181688aa0 _dispatch_call_block_and_release + 24 (init.c:994)
根据崩溃日志,类CallerDetailViewController的GetTitleOffCaller函数中的代码导致了崩溃。在RLMRealm的verifyThread函数中发生崩溃的事实告诉我,您正在尝试访问另一个线程上的领域对象。这在领域中是不允许的,因为对象是线程限制的 您可以签出我并不认为调用了CallerDetailViewController.displayUnableToMarkAsNotSpamErrorMessage。您会注意到,在堆栈跟踪中的位置末尾没有符号化的执行行
我猜这里可能发生了什么,但是,如果不实际查看您的代码或不了解这些方法中的任何一种实际上是什么,我就无法确定它为什么会出现在堆栈跟踪中。根据崩溃报告,它不是blockCallerblockNumber@OscarApepland我花了好几天时间阅读崩溃教程,但都没有结果。这就是问题的原因,因为它们没有帮助。方法blockNumber不会调用方法displayUnableToMarkAsNotSpamErrorMessage,显然它会调用。这里有一个完成处理程序吗?@matt。不,没有。我想我可能知道会发生什么。未调用blockNumber,并且没有涉及完成处理程序。然而,正在调用与blockNumber类似的方法;有5个名称不同的方法,每个方法都有相似的内容,除了一个可本地化的字符串外,每个方法都有不同的内容。也许编译器已经将这些方法优化为一个,这就是为什么它在堆栈中以这种方式出现,这听起来可行吗?对我来说,听起来像flimflam。我认为更可能的情况是,您有线程问题,并且该视图控制器不知何故被错误处理,您看到的情况是对先前发生的错误的诊断。正如你被正确地告知的,要问你自己的问题是为什么Realm认为你在错误的线程上。谢谢你,是的,我知道getTitleOfCaller正在发生崩溃,我知道Realm的线程问题。然而,我的问题是,为什么调用堆栈显示的调用序列没有发生。好吧,它似乎确实发生了,因为你正在经历崩溃。尝试在displayUnableToMarkAsNotSpamErrorMessage函数中添加断点,看看会发生什么。
func blockNumber()
{
Model.log("CallerDetailViewController:blockNumber()")
if editActionIsInProgress == true
{
return
}
var op : UsageStats.Op = UsageStats.Op("IOS-VZ-UI-\(self.VCNAME)-BLOCKEXISTING")
let mdnToBlock = self.caller!.number
editActionIsInProgress = true
RootNavigationController.displayActivityIndicator(message: NSLocalizedString("VC_CALLER_DETAIL_BLOCKING_IN_PROGRESS", comment: ""))
if isExistingCaller
{
Model.instance().robocallerManager().blockExistingCaller(mdn: mdnToBlock) {(error) -> Void in
Model.log("CallerDetailViewController:blocExistingCaller() completion")
self.editActionIsInProgress = false
RootNavigationController.hideActivityIndicator { () in
DispatchQueue.main.async {
if error == nil
{
self.displayBlockedConfirmationMessage()
self.displayGUIBasedOnCategory()
}
else
{
let err = error! as NSError
self.displayUnableToUnblockErrorMessage(error: err)
let _ = op.withError(error!)
}
UsageStats.collectUIStatistics(op)
}
}
}
}
else
{
let mdn = caller?.number
var op : UsageStats.Op = UsageStats.Op("IOS-VZ-UI-\(self.VCNAME)-BLOCKNEW")
// disable the block button in the popup until the operation has completed to prevent user's from
// tapping it twice
Model.instance().robocallerManager().blockNewCaller(caller: caller!, completion: { (error) in
Model.log("CallerDetailViewController:blockNewCaller() completion")
self.editActionIsInProgress = false
RootNavigationController.hideActivityIndicator(completion: {})
DispatchQueue.main.async {
if error == nil
{
// Fetch the newly added Realm managed object within the main thread to ensure the realm is the one for the main thread
self.caller = Model.instance().database().findCaller(mdn: mdn!)
self.isExistingCaller = true
self.addRealmNotification()
self.displayBlockedConfirmationMessage()
self.displayGUIBasedOnCategory()
}
else
{
let err = error! as NSError
self.displayUnableToUnblockErrorMessage(error: err)
let _ = op.withError(error!)
}
UsageStats.collectUIStatistics(op)
}
})
}
}
func displayUnableToMarkAsNotSpamErrorMessage(error:Swift.Error)
{
var message = self.getTitleOfCaller()
message = message + " - " + (self.caller?.number.formatPhoneNumberForDisplay())! + " " + NSLocalizedString("VC_CALLER_DETAIL_UNABLE_TO_MARK_AS_NOT_SPAM", comment: "")
RootNavigationController.displayErrorDialog(title: message, err: error as NSError)
}