I have a program that does an initial search of users then populates a table. There are two buttons within the table to accept the users request and another to deny, these buttons call an insert function that inputs the results in the database. The array results are being passed to the function but I'm getting an error of 'Could not cast value of type 'Swift.Array' (0x61000028bb50) to 'Swift.String' (0x10cbd0ae0)' on the following line of code:
self.insertShot("No", (gname as? Any as! String as AnyObject))
The gname variable is declared as follows:
var gname = String
Here is the code that is getting the array data:
for i in 0 ..< self.guest.count {
let ava = self.guest[i]["ava"] as? String
let gname = self.guest[i]["username"] as? String
let age = (NSString(format: "%@", self.guest[i]["age"] as! CVarArg) as String)
let city = self.guest[i]["city"] as? String
let state = self.guest[i]["state"] as? String
let url = NSURL(string: ava!)!
self.avas.append(image)
self.gname.append((gname as AnyObject) as! String)
self.tableView.reloadData()