I am using a UITtableView
and when I click on specific UIButton
in a specific UITableViewCell
i want to get some data. So here is my code in cellForRowAtIndexPath
cell1.btndelete.tag = indexPath.row
cell1.btndelete.addTarget(self, action: "buttonClicked:", forControlEvents: UIControlEvents.TouchUpInside)
an in this function i am getting perticualr insex
func buttonClicked(sender:UIButton) {
let dic = downloadeddata.objectAtIndex(0) as! NSDictionary
print(dic)
let buttonRow = sender.tag
print(buttonRow)
let index:Int? = Int(buttonRow)
let filepath = dic["path"]?.objectAtIndex(index!)
print(filepath)
}
But while I get the data in filepath
its throw an error
[__NSCFString objectAtIndex:]: unrecognized selector sent to instance so what is the issue?
This is my array(downloadeddata) data:
(
{
content = "";
file = "http://radio.spainmedia.es/wp-content/uploads/2015/12/tailtoddle_lo4.mp3";
image = "http://radio.spainmedia.es/wp-content/uploads/2015/12/forbes.jpg";
number = 0001;
path = "/Users/itechnotion-mac1/Library/Developer/CoreSimulator/Devices/4785CE7B-7642-45BF-A2E1-7C8FCF7986F9/data/Containers/Data/Application/500EC1B3-E2A4-469E-BF41-9FBE30313BBA/Documents/podcasts/forbes/tailtoddle_lo4.mp3";
subtitle = "Titular forbes";
title = "Forbes 1";
},
{
content = "En este primer programa se tratar\U00e1n asuntos tan importante como este y aquel sin descuidar un poco de todo lo dem\U00e1s";
file = "http://radio.spainmedia.es/wp-content/uploads/2015/12/ogilvy.mp3";
image = "http://radio.spainmedia.es/wp-content/uploads/2015/12/tapas.jpg";
number = 0001;
path = "/Users/itechnotion-mac1/Library/Developer/CoreSimulator/Devices/4785CE7B-7642-45BF-A2E1-7C8FCF7986F9/data/Containers/Data/Application/500EC1B3-E2A4-469E-BF41-9FBE30313BBA/Documents/podcasts/tapas/ogilvy.mp3";
subtitle = Titulareando;
title = "Tapa 1";
}
)
Every time I try, I am getting the same result.