Crashed: com.apple.root.default-qos

倾然丶 夕夏残阳落幕 提交于 2019-12-10 02:19:12

问题


I have a fairly simple app that parses a RSS feed and shows it's content in a table view. It's available on the App Store. I have Crashlytics crash reporting integrated. I recently received two reports. These are a little difficult to decipher.

This has occurred in an iPhone 6 running iOS 10.2.1.

This is from an iPhone 5 running iOS 10.2.1.

Even though it says it's crashing due to privacy violations, I'm not accessing any services that requires permission in my app.

Also searching on com.apple.root.default-qos lead me to believe that this may have something to do with background threads. The only place where I use a background thread is to parse the RSS feed data.

DispatchQueue.global(qos: .background).async {

    guard let data = try? Data(contentsOf: URL) else {
        return
    }

    do {
        let xmlDoc = try AEXMLDocument(xml: data)

        if let items = xmlDoc.root["channel"]["item"].all {
            self.posts.removeAll()

            for item in items {
                let title = item["title"].value ?? ""
                // ...
                self.posts.append(jobPost)
            }

            DispatchQueue.main.async {
                self.saveposts(self.posts)
                self.posts.sort { $0.publishDate > $1.publishDate }
                self.tableView.reloadData()
                UIApplication.shared.toggleNetworkActivityIndicator(show: false)
                self.toggleUI(enable: true)
                if self.refreshControl.isRefreshing { self.refreshControl.endRefreshing() }
            }

        }

    } catch let error as NSError {
        print("RSS parsing failed: \(error)")
        self.showErrorAlert(error)
        UIApplication.shared.toggleNetworkActivityIndicator(show: false)
        self.toggleUI(enable: true)
        if self.refreshControl.isRefreshing { self.refreshControl.endRefreshing() }
    }
}

I tested this code on my iPhone 5 running iOS 9.3.5 and simulators running iOS 10.2 but no crash occurred.

Is there any other way to track down this problem?


回答1:


I would double check all your permissions. In my case, starting with iOS10 you need permissions to save stuff to the user's camera roll. In my app, I was showing a default share sheet and whenever a user selected "save photo" the app crashed with one of these very not helpful error messages. I added

<key>NSPhotoLibraryAddUsageDescription</key>
    <string>Allow you to save charts and graphs from the app to your phone.</string>

to my info.plist, clean & run. And everything the problem was solved.



来源:https://stackoverflow.com/questions/42723130/crashed-com-apple-root-default-qos

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!