I created an SQLite
table with a row id integer PRIMARY KEY
. I used this tutorial to integrate SQLite
with my app. I'm trying to add that to an array
of Ints
. Here's my code:
let all = "select id from \(self.tableName)"
let fullArray = self.dbManager.loadDataFromDB(all)
for currentObject in fullArray {
println(currentObject[0])
println(_stdlib_getDemangledTypeName(currentObject[0]))
self.tableViewData.append(currentObject[0] as! Int) //tableViewData is an array of Ints
}
Results of println
statements:
2
Swift.ImplicitlyUnwrappedOptional
When I run the app, I get the following error at the last line of the code.
Could not cast value of type '__NSCFString' (0x103c93c50) to 'NSNumber' (0x103535b88).
What am I doing wrong, and how can I fix it?