本文介绍了错误:预期;在声明列表的末尾-类未被识别为类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的viewcontroller.h文件:

Here is my viewcontroller.h file:

#import <UIKit/UIKit.h>
#import <CoreData/CoreData.h>
#import <CoreLocation/CoreLocation.h>
#import <AVFoundation/AVFoundation.h>
#import <CoreMedia/CoreMedia.h>
#import <ImageIO/ImageIO.h>
#import <CoreVideo/CoreVideo.h>


@interface ViewController : UIViewController <UINavigationControllerDelegate,  CLLocationManagerDelegate>

@property (nonatomic, strong) NSManagedObjectContext *managedObjectContext;
@property(nonatomic, weak) IBOutlet UIImageView *selectedImageView;
@property(nonatomic, retain) IBOutlet UIImageView *vImage;
@property(nonatomic, retain) AVCaptureStillImageOutput *stillImageOutput;

- (IBAction)photoFromAlbum;
- (IBAction)photoFromCamera;
- (IBAction)saveImageToAlbum;
- (IBAction)segueToChoosePhotoTypeViewController;

@end

该行:

@property(nonatomic, retain) AVCaptureStillImageOutput *stillImageOutput;

正在产生以下问题:

Expected ; at end of declaration list.

Xcode无法将AVCaptureStillImageOutput识别为类,因为它保持黑色并且不建议将其作为类型,并且"Fix-it"希望在AVCaptureStillImageOutput之后插入;.

Xcode isn't recognizing AVCaptureStillImageOutput as a class as it remains black and doesn't suggest it as a type, and the "Fix-it" wants to insert the ; right after AVCaptureStillImageOutput.

但是,如果我尝试在我的viewController.m文件的viewDidLoad中使用声明AVCaptureStillImageOutput作为类型,它会识别它并将其允许为类型.此外,其余的AVFoundation类也可以在该代码中识别.

However, if I try to use declare AVCaptureStillImageOutput as a type in viewDidLoad of my viewController.m file, it recognizes it and allows it as a type. Also, the rest of the AVFoundation classes are being recognized in the code there.

框架在那里,我只是与此@property声明有关的问题.

The framework is there, I'm just having an issue with this @property declaration.

推荐答案

在您的行中

@property(nonatomic, retain) AVCaptureStillImageOutput *stillImageOutput;

AVCaptureStillImageOutput*stillImageOutput之间有一些不可见字符.如果将此行粘贴到vi编辑器中,它看起来像这样:

you have some invisible characters between AVCaptureStillImageOutput and *stillImageOutput. If I paste this line into the vi editor, it looks like this:

@property(nonatomic, retain) AVCaptureStillImageOutput<feff><feff><feff><feff><feff> *stillImageOutput;

(U + FEFF是Unicode字节序标记,即使激活了显示不可见",它也看起来像Xcode中的普通空格.)

(U+FEFF is a Unicode Byteorder marker, and it looks like a normal space in Xcode, even if "Show Invisibles" is activated).

删除并重新插入空格可解决此问题.

Deleting and re-inserting the space fixes the problem.

这篇关于错误:预期;在声明列表的末尾-类未被识别为类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

05-27 20:26
查看更多