NSMutableArray
に私のPlatform
クラス(基本ストレージクラス、サブクラスNSObject
)のオブジェクトを追加するには、以下のコードを使用しています。 NSLog
文の出力は0
です。要素を追加した後、配列数は0ですか?
どうすればいいですか?
Platform *platform = [Platform platformWithLabel:label identifier:identfier];
[self.platforms addObject:platform];
NSLog(@"%i", [self.platforms count]);
これはPlatform
の作成方法です:
+(Platform *)platformWithLabel:(NSString *)label identifier:(int)identifier
{
Platform *platform = [[Platform alloc] init];
platform.label = label;
platform.identifier = identifier;
return platform;
}
私はARCを使用しています。
@property (strong, nonatomic) NSMutableArray *platforms;