我有ViewControllerA
和ViewControllerB
。在每个我有这个属性
@property (retain, nonatomic) NSMutableArray *racersArray;
在ViewControllerA中,我用自定义对象填充racersArray
。当我按下ViewControllerA
上的汉堡按钮时,我将已填充的_racersArray
存储到单个数组,然后我向ViewControllerB
发送通知,表明我的_racesArray
内容尚未包含在单身内容中阵列。我用这个方法:
- (void)burgerMenu
{
[ArraySingleton sharedManager].sharedArray = _racersArray;
// Send a notification to burger menu view controller to reload it's tableview
[[NSNotificationCenter defaultCenter] postNotificationName:@"ReloadTableViewData" object:nil];
// Opens the burger menu
[self.frostedViewController presentMenuViewController];
}
在ViewControllerB
收到通知时,我称这种方法为:
- (void)reloadTableviewData
{
_racersArray = [ArraySingleton sharedManager].sharedArray;
[self.tableView reloadData];
}
但是在我尝试将单个数组中的数据加载到_racersArray
后,我的应用程序崩溃并出现错误:
[Racer count]: unrecognized selector sent to instance 0x7fe46aef7330
2016-10-03 23:58:44.091 Stopwatch[67948:6727940] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[Racer count]: unrecognized selector sent to instance 0x7fe46aef7330'
这就是我的单身人士的样子
@synthesize sharedArray;
+ (ArraySingleton *)sharedManager
{
static ArraySingleton *sharedMyManager = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
sharedMyManager = [[ArraySingleton alloc] init];
});
return sharedMyManager;
}
- (id)init
{
if (self = [super init]) {
sharedArray = [[NSMutableArray alloc] initWithObjects:@"picee", nil];
}
return self;
}
谁能告诉我我做错了什么?
由于