我知道这是一个新手问题,但我很困惑。我应该如何从另一个类调用类方法,还是不应该?
这是我的ClassA
和CoreDataHelper
:
#import <Foundation/Foundation.h>
@interface ClassA : NSObject {
}
@property (nonatomic, retain) NSString * sessionId;
@property (nonatomic, retain) NSString * token;
@property (nonatomic, retain) NSString * userid;
+ (void) pullOfflineDataWithContext:(NSManagedObjectContext *)managedObjectContext ;
@end
#import "ClassA.h"
#import "CoreDataHelper.h"
@implementation ClassA
+ (void) pullOfflineDataWithContext:(NSManagedObjectContext *)managedObjectContext {
// get Contacts, Accounts, Meetings into Core Data
bool asd =[CoreDataHelper insertAllObjectsForEntity:@"Contact" andContext:managedObjectContext initCoreData:jsonDict];
}
@end
#import <Foundation/Foundation.h>
#import <CoreData/CoreData.h>
@interface CoreDataHelper : NSObject
//For inserting objects
+(BOOL)insertAllObjectsForEntity:(NSString*)entityName andContext:(NSManagedObjectContext *)managedObjectContext;
@end