私はiosの初心者で、コントローラー間でデータを共有するための単純なシングルトンオブジェクトを作成しようとしています. これが私のコードです:
#import <Foundation/Foundation.h>
#import "SynthesizeSingleton.h";
@interface BSStore : NSObject
+(BSStore *)sharedStore;
@property (nonatomic,strong) NSArray *sharedNotebooks;
@end
#import "BSStore.h"
@implementation BSStore
SYNTHESIZE_SINGLETON_FOR_CLASS(BSStore)
@synthesize sharedNotebooks;
@end
// AppDelegate にオブジェクトを書き込む
[BSStore sharedStore].sharedNotebooks = notebooks;
//ViewController でオブジェクトを読み取る
Notebook *notebook = [[BSStore sharedStore].sharedNotebooks objectAtIndex:indexPath.row];
そして私は得る:
2012-10-04 02:01:29.053 BarneyShop[1827:f803] +[BSStore sharedStore]: unrecognized selector sent to class 0x69b8
2012-10-04 02:01:29.073 BarneyShop[1827:f803] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '+[BSStore sharedStore]: unrecognized selector sent to class 0x69b8'
*** First throw call stack: