iOS:控件到达非void函数的结尾

时间:2015-01-20 20:53:29

标签: ios objective-c runtime-error

我在appdelegate.m文件中收到错误,位于以下代码行:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
}

我之前没有在这些括号内有任何内容,并且在我上次提交和今天打开它之间没有对应用程序进行任何更改。毋庸置疑,我有点被抛弃了。

修改

在描述的初始字段中返回YES后,我在另一部分代码中收到了相同的错误:

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

    NSString *cellIdentifier = [menu objectAtIndex:indexPath.row];
   // UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier: cellIdentifier forIndexPath:indexPath];

   //return cell;
}

2 个答案:

答案 0 :(得分:2)

该方法需要返回BOOL值。您通常只返回YES。很可能你的代码已被更改。

答案 1 :(得分:0)

您已注释了返回cell值的代码。

你的cellforRowatindexpath代码应该是这样的。

您的代码已明确修改。没有这个,应用就无法运行。

请检查一下。

进行与您的应用相关的必要更改。

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *simpleTableIdentifier = @"SimpleTableItem";

        UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:simpleTableIdentifier];

        if (cell == nil) {
            cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:simpleTableIdentifier];
        }

        cell.backgroundColor = [UIColor clearColor];

        return cell;
    }