当前位置:  开发笔记 > 前端 > 正文

了解Swift中的崩溃报告(部分应用...)

如何解决《了解Swift中的崩溃报告(部分应用)》经验,为你挑选了0个好方法。

我是Swift编程的新手,最近我用Swift实现了我的应用程序的聚光灯搜索.一切都运行良好,但我现在得到的崩溃报告很少,我不知道什么是"部分应用"以及为什么它会崩溃.因为我无法在本地模拟它我试图通过使用来解决它崩溃日志.以下是崩溃报告......

Thread : Crashed: com.apple.root.default-qos
0  AppName                        0x1076d4 partial apply for static spotLightSearchManager.(indexAllItem in _03019F3D5642F39F2DF678310DF7E384)() -> () (spotLightSearchManager.swift:77)
1  AppName                        0x10761c partial apply for static spotLightSearchManager.(indexAllItem in _03019F3D5642F39F2DF678310DF7E384)() -> () (spotLightSearchManager.swift:73)
2  AppName                        0x107730 partial apply for thunk (spotLightSearchManager.swift)
3  AppName                        0x107808 partial apply for static spotLightSearchManager.(clearAllItem(spotLightSearchManager.Type) -> (OnCompletion : () -> ()!) -> ()).(closure #1) (spotLightSearchManager.swift:85)
4  CoreSpotlight                  0x2ae7ce0d __45-[CSSearchableIndexRequest _finishWithError:]_block_invoke + 20
5  libdispatch.dylib              0x2492fdd7 _dispatch_call_block_and_release + 10
6  libdispatch.dylib              0x2493b7b9 _dispatch_root_queue_drain + 1572
7  libdispatch.dylib              0x2493b193 _dispatch_worker_thread3 + 94
8  libsystem_pthread.dylib        0x24ac8e0d _pthread_wqthread + 1024
9  libsystem_pthread.dylib        0x24ac89fc start_wqthread + 8

我正在尝试在应用启动期间重新索引搜索项目.

 static func reIndexAllItem () {

        if #available(iOS 9.0, *) {

            clearAllItem(OnCompletion: indexAllItem)


        } else {
            // Fallback on earlier versions
            APLog("SpotLight index not added for older versions")
        }
    }
}

static private func indexAllItem () {

    for dataItem in APAuthUrlDataSource.sharedInstance().accountArray { // Crash logs points to this line.

        addSearchIndexForItem(dataItem as! APAuthUrlDataItm)
    }
} // Line number 77

static func clearAllItem (OnCompletion completion : (()-> Void)!) {

        if #available(iOS 9.0, *) {
            CSSearchableIndex.defaultSearchableIndex().deleteAllSearchableItemsWithCompletionHandler { (error) -> Void in
                // On completion.
                APLog("successfully cleared all index in spotlight search")
                **completion()** //Line number 85
            }
        } else {
            // Fallback on earlier versions
            APLog("SpotLight index not cleared for older versions")
        }
}

注意:从didFinishLaunchingWithOptions方法调用reindexAlltem.

任何帮助真的很感激,在此先感谢.

推荐阅读
U友50081205_653
这个屌丝很懒,什么也没留下!
DevBox开发工具箱 | 专业的在线开发工具网站    京公网安备 11010802040832号  |  京ICP备19059560号-6
Copyright © 1998 - 2020 DevBox.CN. All Rights Reserved devBox.cn 开发工具箱 版权所有