不能指定存储类(Objective-c)错误

时间:2011-07-06 01:11:28

标签: objective-c ios xcode cocoa-touch

我一直在

error: no type or storage class may be specified here before 'interface'

这是图像:

enter image description here

和代码:

#import <Foundation/Foundation.h>

@interface Utilities : NSObject {

}

+ (NSString *)getDocumentsDirectory;
+ (void)showActivityIndicator;
+ (void)hideActivityIndicator;
+ (void)setUser:(NSString *)userName withPassword:(NSString *)password;
+ (NSString *)getUserName;
+ (NSString *)getPassword;
+ (long long)generateTicketNumber;
+ (BOOL)reachable;
+ (NSString *)printerAddress;
+ (NSInteger)port;
+ (void)setAddress:(NSString*)newAddress andPort:(NSInteger)newPort;
+ (void)showDataActivity;

@end


@interface CustomUITextField:UITextField{
    NSInteger rowNumber;
}

@property (nonatomic) NSInteger rowNumber;

@end

我将.m文件简化为简单:

#import "Utilities.h"

@implementation Utilities

@end

我仍然得到错误。 (当然,我得到了没有实施方法的警告。)

我一直试图找出过去2-3小时的错误。请帮忙。感谢。

**更新:**我将两个班级分开,突然间,我在一个完全不同的班级中得到“未找到属性声明......”错误。

这是我的DataCenter.h

#import <Foundation/Foundation.h>


@interface DataCenter : NSObject {
    BOOL updating;
    NSDictionary *dataDictionary;
}

@property (nonatomic, retain) NSDictionary *dataDictionary;

+ (DataCenter *)sharedInstance;
- (void)update;
- (NSArray *)getSTData;
- (BOOL)saveSTData;
- (NSArray *)getLookUpsData;
- (NSDate *)lastUpdated;

- (NSArray *)pendingData;
- (void)registerNewTicket:(NSDictionary *)ticketInfo;
- (void)savePendingData:(NSArray *)data;

@end

我得到“属性声明不在实现或接口上下文中”

1 个答案:

答案 0 :(得分:0)

将包含/导入此标头的任何位置编译头文件的内容。检查您是否在#import之前发生错误的其他文件中导入Utilities.h。