“预期方法主体"错误 [英] “Expected method body” error

查看:88
本文介绍了“预期方法主体"错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用程序运行正常,然后什么也不做,却在appDelegate.h中出现2个错误.有人这样说:

I had my application working fine, then without doing anything, out of nowhere I got 2 errors in appDelegate.h. One says this:

Objective-C方法的预期选择器

Expected selector for Objective-C method

另一个说:

预期的方法主体

Expected method body

我不知道为什么会这样,我有其他项目具有完全相同的应用程序委托,而且它们都可以正常工作.

I have no idea why this is happening, I have other projects with the exact same app delegate and they all work just fine.

这是我的appDelegate.h:

This is my appDelegate.h:

#import <UIKit/UIKit.h>

@interface AppDelegate : UIResponder <UIApplicationDelegate> // I get the errors here

@property (strong, nonatomic) UITabBarController *tbc; 
@property(strong, nonatomic) UIWindow *window;

@end

推荐答案

我遇到了同样的问题.最后,我发现在main.m中,我不小心在文件开头添加了-"字符.

I had the same problem. At last I found that in my main.m I had accidentally added a "-" character in the beginning of the file.

删除字符解决了这个问题.

Removing the character solved the problem.

这篇关于“预期方法主体"错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆