我得到错误索引超出范围数组指数超出范围阵列迅速的
这里是我的代码
.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")
}
}
我使用alamofire下载的PDF文件,并获得路径(localPath来),并追加它到localPathArray。构建成功,并可以完全下载,但如果我想查看PDF文件,它打印索引超出范围。
好这个问题,最有可能,是'indexPath.row',我猜你设定的行数错误值。 – 4oby
啊,是的,我检查它,下载后的索引路径是不正确的,但一些PDF文件具有正确的索引路径,以便它可以查看。有什么方法可以解决它? –