Jes*_*per 0 objective-c nsmutablearray
任何人都可以告诉我为什么登录[self.giftees count]仍然返回0,即使我正在添加对象?
标题:
#import <UIKit/UIKit.h>
@interface Test2AppDelegate : NSObject <UIApplicationDelegate>
{
UIWindow *window;
NSMutableArray *giftees;
}
@property (nonatomic, retain) UIWindow *window;
@property (nonatomic, retain) NSMutableArray *giftees;
@end
Run Code Online (Sandbox Code Playgroud)
从didFinishLaunchingWithOptions调用:
- (void)bootstrapGiftees
{
NSArray *gifteeNames = [NSArray arrayWithObjects:@"Jesse",,nil];
for (NSString *gifteeName in gifteeNames)
{
GifteeModel *g = [[GifteeModel alloc] init];
g.name = gifteeName;
[self.giftees addObject:g];
NSLog(@"giftees count = %d", [self.giftees count]);
[g release];
}
}
Run Code Online (Sandbox Code Playgroud)