Objective c 表视图iOS 8的空数组的索引0超出边界

Objective c 表视图iOS 8的空数组的索引0超出边界,objective-c,uitableview,ios8,Objective C,Uitableview,Ios8,我已经创建了一个选项卡;e编程代码如下所示: tblWebserviceList=[[UITableView alloc] initWithFrame:CGRectMake(345, 304, 430, 180)]; tblWebserviceList.delegate=self; tblWebserviceList.dataSource=self; tblWebserviceList.rowHeight=30; [

我已经创建了一个选项卡;e编程代码如下所示:

        tblWebserviceList=[[UITableView alloc] initWithFrame:CGRectMake(345, 304, 430, 180)];
        tblWebserviceList.delegate=self;
        tblWebserviceList.dataSource=self;
        tblWebserviceList.rowHeight=30;
        [WebServiceView addSubview:tblWebserviceList];
现在,这个表视图添加到一个名为
WebServiceView
的视图中,我只需单击一个按钮即可添加该视图

表视图的委托方法如下所示

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 1;
}
//------------------------------------------------------------------------
// Method : numberOfRowsInSection
// method to set the number of row in the tableview
//------------------------------------------------------------------------
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
            if(arrWebServiceList==nil)
                return 0;

            return [arrWebServiceList count];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *CellIdentifier = @"Cell";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if(cell==nil)
            {
                cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
                cell.selectionStyle=UITableViewCellSelectionStyleNone;
            }
            cell.textLabel.font=[UIFont fontWithName:@"Helvetica" size:15];
            cell.textLabel.text=[arrWebServiceList objectAtIndex:indexPath.row];
            return cell;
}
单击一个按钮,我就有了添加
WebServiceView
的代码,如下所示:

 tblWebserviceList.hidden=YES;
    [self.view addSubview:WebServiceView];
在添加父视图之前,我将隐藏
tblWebserviceList
,并在需要时显示

这都是关于代码的

现在我的问题是,这段代码在ios 7.0和7.1上运行良好

但应用程序在ios 8.0上崩溃。要调试此代码,我将使用xcode 6的beta 6

崩溃日志如下所示

*** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArrayM objectAtIndex:]: index 0 beyond bounds for empty array'
*** First throw call stack:
(0x22c6bf77 0x30134c77 0x22b803d7 0x40b94f 0x26315501 0x263192db 0x2624434f 0x25c724c5 0x25c6dec1 0x25c6dd49 0x25c6d737 0x25c6d541 0x25c6744d 0x22c32835 0x22c2ff19 0x22c3031b 0x22b7dda1 0x22b7dbb3 0x2a063051 0x262a5c41 0x53aed 0x53438)
libc++abi.dylib: terminating with uncaught exception of type NSException
我认为这个问题只有在表的第一次数据源数组包含0记录时才会出现,因为我首先显示空表,然后在插入web服务url后添加记录

如果记录大于0,则它将正常工作。仅针对0条记录发出

请帮助我

谢谢

更改此行

cell.textLabel.text=[arrWebServiceList objectAtIndex:indexPath.row];


Stacktrace和相关源文件。对不起,我已经发布了代码。我无法提供u文件和其他资料好的,我怀疑当时是否有人能提供帮助。对于空数组,控件不会进入CellForRowAtEndPath函数。我已经调试过了。对于空数组,我返回行数=0@svrushal,这是不应该的,但谁知道ios 8做了什么beta@Cy-4AH,但我希望我的应用程序应该运行在ios 8上。这就是我检查它的原因。@Cy-4AH如果你不能回答这个问题,就不需要向下投票:(@svrushal,我不是向下投票人。我想我们只需要等待ios 8发布。我也在ios 8问题中看到过,当环境为实现该选择器的对象抛出
无法识别的选择器
异常时,在ios 6和ios 7中一切都很好。
cell.textLabel.text = [arrWebServiceList count] > 0 ? [arrWebServiceList objectAtIndex:indexPath.row] : @"DummyText";