预期标识符或'('编译Objective-C时

-2 objective-c

所以我试图制作这个相机应用程序,但每次我尝试运行它,它会说"预期标识符或'('.我得到其中两个错误.其中一个正好在下面 - (IBAction)takePhoto:(UIButton *)sender;,一个在- (IBAction)selectPhoto:(UIButton *)sender; 谢谢之下

#import <UIKit/UIKit.h>

@interface APPViewController : UIViewController <UIImagePickerControllerDelegate, UINavigationControllerDelegate>

@property (strong, nonatomic) IBOutlet UIImageView *ImageView;


- (IBAction)takePhoto:(UIButton *)sender;
{
 UIImagePickerController *picker = [[UIImagePickerController alloc] init];
    picker.delegate = self;
    picker.allowsEditing = YES;
    picker.sourceType =UIImagePickerControllerSourceTypeCamera;

    [self presentViewController:picker animated:YES completion:NULL];
}

- (IBAction)selectPhoto:(UIButton *)sender;
{
    UIImagePickerController *picker = [[UIImagePickerController alloc] init];
    picker.delegate = self;
    picker.allowsEditing = YES;
    picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;

    [self presentViewController:picker animated:YES completion:NULL];
}
@end
Run Code Online (Sandbox Code Playgroud)

Wai*_*ain 5

@interface(一般.h文件)只持有类接口.它不应该包含类实现(方法内容).这是在.m文件(特别是,@ implementation).所以你需要把它移到那里.