i get error index out of range in array
here's my code
.response { request, response, _, error in
self.localPath = destination(NSURL(string: "")!, response!)
self.localPathArray.append(self.localPath!)
}
cell.progressDownload.hidden = false
cell.progressLabel.hidden = false
}
if statusInstantiante == true {
let mainStoryBoard:UIStoryboard = UIStoryboard(name: "Main", bundle: nil)
let vc:RedirectMagazineViewController = mainStoryBoard.instantiateViewControllerWithIdentifier("NEXT") as! RedirectMagazineViewController
vc.receiveData = self.localPathArray[indexPath.row] //Error
vc.receiveTitle = titleMagazine[indexPath.item]
self.navigationController?.pushViewController(vc, animated: true)
} else {
print("still downloading")
}
}
I Download pdf file using alamofire download, and get the path (localPath) and append it to localPathArray. the build succeded and can download completely but if i want to view the pdf file it prints index out of range.
indexPath.row, I guess you set the wrong value for number of rows.