データベースからデータを読み取る favDatabase があります。
.h
@interface favDatabase : NSObject {
UIWindow *window;
UINavigationController *navigationController;
NSString *databaseName;
NSString *databasePath;
NSMutableArray *idSPBData;
}
.m
- (void)applicationDidFinishLaunching:(UIApplication *)application {
// Setup some globals
databaseName = @"usualBike.sql";
// Get the path to the documents directory and append the databaseName
NSArray *documentPaths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDir = [documentPaths objectAtIndex:0];
databasePath = [documentsDir stringByAppendingPathComponent:databaseName];
// Execute the "checkAndCreateDatabase" function
[self checkAndCreateDatabase];
// Query the database for all favorites
[self getFavorites];
// Configure and show the window
[window addSubview:[navigationController view]];
[window makeKeyAndVisible];
}
今私のお気に入りのビューで、データを読み取ろうとします:
favDatabase *fav = (favDatabase *)[UIApplication sharedApplication];
return fav.idSPBData.count;
しかし、それはクラッシュします:
2012-09-03 13:44:13.692 usualBike[1857:11603] -[UIApplication idSPBData]: unrecognized selector sent to instance 0x6e2f5a0
2012-09-03 13:44:13.693 usualBike[1857:11603] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIApplication idSPBData]: unrecognized selector sent to instance 0x6e2f5a0'
Xcode 4.3 を使用していますが、これはリリースの問題ですか?