Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Crashed: com.apple.root.default-qos

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.

enter image description here

This is from an iPhone 5 running iOS 10.2.1.

enter image description here

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?

like image 946
Isuru Avatar asked Mar 10 '17 16:03

Isuru


1 Answers

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.

like image 195
Chase Roberts Avatar answered Oct 18 '22 17:10

Chase Roberts