Ios 从NSArray内容读取远程pdf时出现问题?

Ios 从NSArray内容读取远程pdf时出现问题?,ios,uitableview,nsarray,nsrangeexception,Ios,Uitableview,Nsarray,Nsrangeexception,我想阅读一些远程PDF,因此我创建了一个包含URL的NSArray,但当我尝试阅读它时,我得到了以下结果: Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArrayI objectAtIndex:]: index 2 beyond bounds [0 .. 0]' 这是我的密码 -(void)prepareForSegue:(UIStoryboardSegue *)segue s

我想阅读一些远程PDF,因此我创建了一个包含URL的
NSArray
,但当我尝试阅读它时,我得到了以下结果:

Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArrayI objectAtIndex:]: index 2 beyond bounds [0 .. 0]'
这是我的密码

-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender{

    if ([[segue identifier] isEqualToString:@"CircularDetail"]) {

        CircularDetailViewController *circulardetail = [self.storyboard instantiateViewControllerWithIdentifier:@"CircularControllerDetail"];

        NSIndexPath *myIndexPath = [self.tableView indexPathForSelectedRow];
        int row = [myIndexPath row];

        circulardetail.DetailModal = [NSArray arrayWithObjects:_SeccionCirculares[row], _circularfecha[row], _circularTitulo[row], _circularURL[row], nil];

        [self presentViewController:circulardetail animated:YES completion:nil];
    }
}
在细节上我有这个

- (void) loadRemotePdf
{
        NSURL  *myUrl = [NSURL URLWithString:[_DetailModal objectAtIndex:3]];
        NSURLRequest *myRequest = [NSURLRequest requestWithURL:myUrl];

        [self.webview loadRequest:myRequest];
}
创建视图控制器的新实例。你可能想要

CircularDetailViewController *circulardetail =
     (CircularDetailViewController *)[segue destinationViewController];
相反

您不必调用
presentViewController
进行序列转换

您还应该注意,参数列表中的任何
nil
对象

circulardetail.DetailModal = [NSArray arrayWithObjects:...];

终止列表,因此数组可能比预期的短。

您有几个数组-其中有什么?哪一个失败了?每次访问阵列之前都要记录阵列内容。在访问内容之前,请检查数组
计数
circulardetail.DetailModal = [NSArray arrayWithObjects:...];