-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