iOS设备上:控制到达非void函数
问题描述:
我得到了错误的appdelegate.m文件,在下面的代码行的末尾:iOS设备上:控制到达非void函数
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
}
我以前没有这些括号内的任何,而且我的最后一次提交和今天的提交没有发生变化。不用说我有点被抛弃。
EDIT
中描述的初始场返回YES
后,我在另一个代码部分接收的相同的错误:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
NSString *cellIdentifier = [menu objectAtIndex:indexPath.row];
// UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier: cellIdentifier forIndexPath:indexPath];
//return cell;
}
答
的方法,预计要返回一个BOOL
值。您通常只需返回YES
。很可能你的代码被改变了。
+0
这样做固定了最初的错误,但在另一个地方创建了另一个错误。在OP上面发表 – JBD321 2015-01-21 03:39:46
答
您已评论返回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;
}
的信息是很清楚的,尽管你说的这种方法没有任何事情,我不认为这种情况下,如果你的应用程序编译过 - 你需要从这个返回'BOOL'方法 - 方法签名显示了这一点。你应该返回'YES' - Xcode模板提供的默认实现为你做这件事。 – Paulw11 2015-01-20 20:57:57