-1
我不得不將一些現有代碼從AppDelegate中移出並將其放在普通類中,以便應用程序不必重新啓動。在我做這件事之前,一切都在沒有錯誤的情況下建立並正確執行。這是我的.h文件中的代碼:不明白爲什麼我會得到「方法定義未找到錯誤」
#import <Foundation/Foundation.h>
#import "AppDelegate.h"
#import "SingletonClass.h"
#import "SettingsViewController.h"
#import "CoreData+MagicalRecord.h"
@interface CommonMethods : NSObject {
}
@property (nonatomic, strong) NSMutableArray *unsortedNailArray;
@property (nonatomic, strong) NSMutableArray *unsortedHairArray;
@property (nonatomic, strong) NSMutableArray *unsortedCustomArray;
-(void) sortAndReloadServicesArray: (NSMutableArray *) textboxValues;
-(void) initalizeEnsembles;
-(void) displayAlert: (NSString *)alertTitle andMessage: (NSString *)alertMessage andViewController: (UIViewController *) viewController andTag:(int)tag;
-(NSMutableDictionary *) createStaffNamesDictionary;
-(NSMutableArray *) createStaffNamesArray;
-(BOOL)testConnectionToInternet;
-(void) initializeEnsembles; // definition that is missing?
- (NSString *) convert12HourTimeTo24HourTime: dateString andReturnType: (NSString *) dateOrDateTime;
- (NSString *) convert24HourTimeTo12HourTime: (NSString *)timeString;
- (NSNumber *) checkForApptOverlap: startTime andStopTime: stopTime andServiceTech: serviceTech;
@end
這是相關的.m文件:
#import "CommonMethods.h"
@interface CommonMethods() <CDEPersistentStoreEnsembleDelegate>
@end
@implementation CommonMethods {
CDEPersistentStoreEnsemble *ensemble;
CDEICloudFileSystem *cloudFileSystem;
}
@synthesize unsortedNailArray;
@synthesize unsortedHairArray;
@synthesize unsortedCustomArray;
#pragma mark - initializeEnsembles
-(void) initializeEnsembles { // <---- here it is!
// set Ensembles verbose logging
CDESetCurrentLoggingLevel(CDELoggingLevelVerbose);
// Ensemble: load the model
NSManagedObjectModel *model = [NSManagedObjectModel MR_newManagedObjectModelNamed:@"salonbook.momd"]; // (xcdatamodeld)
[NSManagedObjectModel MR_setDefaultManagedObjectModel:model];
令人難以置信!非常感謝! (我看了一下,看了一個多小時......) – SpokaneDude