I am facing a problem which must be deep in iOS8 - or I have overseen some obvious problem. Any help is welcome.
Description: In have created a JobTableViewController, which is displaying a list of jobs (filenames) and their job status in a table as label and detail label.
If the user selects one entry more details of this job are displayed in the next controllers and can be changed on the following pages. On the return to this controller the job status should be updated and displayed in the detail label. I have tested the app in different simulators and it is working as expected.
But if I run the app on my iPhone, it crashes with EXC_BAD_ACCESS(code 1, address =… ) // the address is changing on every run while it is accessing m_jobListStatus. If have added a println() statement, which is printing fine. The app is always crashing on the second return to this controller.
class JobTableViewController: UITableViewController {
// some private vars here
private var m_jobListStatus = [String:String]()
override func viewDidLoad() {
…
if let s = m_defaults.dictionaryForKey(CONSTANTS.JOB_LIST_STATUS) as? [String:String] {
m_jobListStatus = s
}
}
…
// update the status in the table, save the status in the system defaults file and save the changes in file
override func viewDidAppear(animated: Bool) {
if let file = m_filename {
println("\nin ViewDidAppear m_jobListStatus = \(m_jobListStatus) , \(checkJobStatus(file)), \(file)")
self.m_jobListStatus[file] = checkJobStatus(file) // < < < < - - - - - - C r a s h is here
m_defaults.setObject(m_jobListStatus, forKey: CONSTANTS.JOB_LIST_STATUS)
tableView.reloadData()
var json = MeterReading.saveToJSON(m_readingList)
json?.writeToFile(CONSTANTS.DOCS_DIR + file, atomically: true)
m_filename = nil
}
}
…
}
The output of the println looks as expected:
in ViewDidAppear m_jobListStatus = [Auftrag-2015-03-01_12.17.39.meters: In Bearbeitung, Auftrag-2015-02-27_20.36.33.meters: Neu] , Neu, Auftrag-2015-02-27_20.36.33.meters
in ViewDidAppear m_jobListStatus = [Auftrag-2015-03-01_12.17.39.meters: In Bearbeitung, Auftrag-2015-02-27_20.36.33.meters: Neu] , In Bearbeitung, Auftrag-2015-03-01_12.17.39.meters
Any ideas?
Thanks in advance
Aucun commentaire:
Enregistrer un commentaire