-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathAbstractModel.m
49 lines (36 loc) · 1.28 KB
/
AbstractModel.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
//
// AbtsractModel.m
// MapShop
//
// Created by Mike Bevz on 17/03/11.
// Copyright 2011 __MyCompanyName__. All rights reserved.
//
#import "AbstractModel.h"
@implementation AbstractModel
@synthesize _delegate;
#pragma mark -
#pragma mark Abstract Models Methods
+ (void)update: (id)delegate {
if ([self path] != @"Not Implemented") {
AbstractModel *obj = [[self class] alloc];
[obj set_delegate:delegate];
RKObjectManager* objectManager = [RKObjectManager sharedManager];
[objectManager loadObjectsAtResourcePath:[self path] objectClass:[self class] delegate:obj];
}
}
// This method must be overriden
+ (NSString*) path {
return @"Not Implemented";
}
#pragma mark -
#pragma mark RKObjectLoaderDelegate methods
- (void)objectLoader:(RKObjectLoader*)objectLoader didLoadObjects:(NSArray*)objects {
//_delegate._reloading = NO;
//[_delegate set_reloading: NO];
[_delegate performSelector:@selector(doneLoadingTableViewData) withObject:nil];
}
- (void)objectLoader:(RKObjectLoader*)objectLoader didFailWithError:(NSError*)error {
UIAlertView* alert = [[[UIAlertView alloc] initWithTitle:@"Error" message:[error localizedDescription] delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil] autorelease];
[alert show];
}
@end