这是我的自定义类:
类A.h
@interface ClassA : NSObject<RKRequestDelegate>{
NSString *uri;
NSString *folderUri;
NSInteger idFolder;
NSString *kind;
bool isMine;
CustomUser *owner;
NSMutableArray *usersAdministrators;
NSMutableArray *usersContributors;
NSMutableArray *usersReaders;
NSString *visibility;
NSString *name;
NSString *description;
NSMutableArray *comments;
}
@property (nonatomic,copy) NSString *uri;
@property (nonatomic,copy) NSString *folderUri;
@property (nonatomic,assign) NSInteger idFolder;
@property (nonatomic,copy) NSString *kind;
@property (nonatomic,assign) bool isMine;
@property (retain) DMIUser *owner;
@property (nonatomic,copy) NSMutableArray *usersAdministrators;
@property (nonatomic,copy) NSMutableArray *usersContributors;
@property (nonatomic,copy) NSMutableArray *usersReaders;
@property (nonatomic,copy) NSString *visibility;
@property (nonatomic,copy) NSString *name;
@property (nonatomic,copy) NSString *description;
@property (nonatomic,copy) NSMutableArray *comments;
@end
类A.m
@implementation ClassA
@synthesize uri,folderUri,idFolder,kind,isMine,owner,usersAdministrators,usersContributors,usersReaders,visibility,name,description,comments;
-(NSString*)description {
return @"ClassA";
}
@end
非常简单。但是当我尝试创建这个的新实例时,像这样:
datas = [NSMutableArray array]; // Tried with [[NSMutableArray alloc] init] => same thing
ClassA *classA = [[ClassA alloc] init];
[datas addObject:classA];
NSLog(@"classA = %@",classA);
NSLog(@"datas = %@",datas);
第一个 NSLog 返回“ClassA”。第二个 NSLog 返回“datas = ()”
这里有什么问题?我总是创建这样的课程,我从来没有遇到过这样的问题。谢谢!