- Fix SharedInstance User
- Fix Object save Locally - Fix Object fetch Locally - Add Object delete Locally
This commit is contained in:
parent
7e5a6149a8
commit
4c97b281ed
@ -30,16 +30,22 @@
|
|||||||
PNUser *user = [PNUser currentUser];
|
PNUser *user = [PNUser currentUser];
|
||||||
|
|
||||||
|
|
||||||
NSLog(@"asd");
|
NSLog(@"user : %@",[user getJSONObject]);
|
||||||
/*[user setFirstName:@"Giuseppe"];
|
|
||||||
[user setLastName:@"Nucifora"];
|
//[user autoRemoveLocally];
|
||||||
[user setHasAcceptedNewsletter:YES];
|
/*[user setFirstName:@"Giuseppe2"];
|
||||||
|
[user setLastName:@"Nucifora2"];
|
||||||
|
[user setEmail:@"giuseppe.nucifora@giuseppenucifora.com"];
|
||||||
|
[user setSex:@"M"];
|
||||||
|
[user setHasAcceptedNewsletter:NO];
|
||||||
[user setHasAcceptedPrivacy:YES];
|
[user setHasAcceptedPrivacy:YES];
|
||||||
[user setUsername:@"giuseppe.nucifora"];
|
[user setUsername:@"giuseppe.nucifora"];
|
||||||
[user setPassword:@"giuseppe.nucifora.password"];
|
[user setPassword:@"giuseppe.nucifora.password"];
|
||||||
[user setPhone:@"+393485904995"];
|
[user setPhone:@"+393485904995"];
|
||||||
|
[user setUserId:@"blablabla"];
|
||||||
[user saveLocally];
|
[user saveLocally];
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//NSLog(@"%@",[user getObject]);
|
//NSLog(@"%@",[user getObject]);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@ -8,8 +8,8 @@
|
|||||||
|
|
||||||
Pod::Spec.new do |s|
|
Pod::Spec.new do |s|
|
||||||
s.name = "PNObject"
|
s.name = "PNObject"
|
||||||
s.version = "0.1.0"
|
s.version = "0.2.0"
|
||||||
s.summary = "PNObject."
|
s.summary = "PNObject is a simple replica of the more complex ParseObject"
|
||||||
|
|
||||||
# This description is used to generate tags and improve search results.
|
# This description is used to generate tags and improve search results.
|
||||||
# * Think: What does it do? Why did you write it? What is the focus?
|
# * Think: What does it do? Why did you write it? What is the focus?
|
||||||
|
|||||||
@ -46,7 +46,7 @@
|
|||||||
failure:(void (^)(NSURLSessionDataTask *task, NSError *error))failure {
|
failure:(void (^)(NSURLSessionDataTask *task, NSError *error))failure {
|
||||||
|
|
||||||
return [[[PNObjectConfig sharedInstance] manager] POST:[[[PNObjectConfig sharedInstance] PNObjEndpoint] stringByAppendingFormat:@"%@",[[self class] objectClassName]]
|
return [[[PNObjectConfig sharedInstance] manager] POST:[[[PNObjectConfig sharedInstance] PNObjEndpoint] stringByAppendingFormat:@"%@",[[self class] objectClassName]]
|
||||||
parameters:[self getObject] constructingBodyWithBlock:^(id<AFMultipartFormData> _Nonnull formData) {
|
parameters:[self getJSONObject] constructingBodyWithBlock:^(id<AFMultipartFormData> _Nonnull formData) {
|
||||||
|
|
||||||
} progress:^(NSProgress * _Nonnull _uploadProgress) {
|
} progress:^(NSProgress * _Nonnull _uploadProgress) {
|
||||||
if (uploadProgress) {
|
if (uploadProgress) {
|
||||||
@ -67,7 +67,7 @@
|
|||||||
failure:(void (^)(NSURLSessionDataTask *task, NSError *error))failure {
|
failure:(void (^)(NSURLSessionDataTask *task, NSError *error))failure {
|
||||||
|
|
||||||
return [[[PNObjectConfig sharedInstance] manager] PUT:[[[PNObjectConfig sharedInstance] PNObjEndpoint] stringByAppendingFormat:@"%@",[[self class] objectClassName]]
|
return [[[PNObjectConfig sharedInstance] manager] PUT:[[[PNObjectConfig sharedInstance] PNObjEndpoint] stringByAppendingFormat:@"%@",[[self class] objectClassName]]
|
||||||
parameters:[self getObject]
|
parameters:[self getJSONObject]
|
||||||
success:^(NSURLSessionDataTask * _Nonnull _task, id _Nullable _responseObject) {
|
success:^(NSURLSessionDataTask * _Nonnull _task, id _Nullable _responseObject) {
|
||||||
if (success) {
|
if (success) {
|
||||||
success(_task,_responseObject);
|
success(_task,_responseObject);
|
||||||
@ -82,7 +82,7 @@
|
|||||||
- (NSURLSessionDataTask *)DELETEWithSuccess:(void (^)(NSURLSessionDataTask *task, id responseObject))success
|
- (NSURLSessionDataTask *)DELETEWithSuccess:(void (^)(NSURLSessionDataTask *task, id responseObject))success
|
||||||
failure:(void (^)(NSURLSessionDataTask *task, NSError *error))failure {
|
failure:(void (^)(NSURLSessionDataTask *task, NSError *error))failure {
|
||||||
return [[[PNObjectConfig sharedInstance] manager] DELETE:[[[PNObjectConfig sharedInstance] PNObjEndpoint] stringByAppendingFormat:@"%@",[[self class] objectClassName]]
|
return [[[PNObjectConfig sharedInstance] manager] DELETE:[[[PNObjectConfig sharedInstance] PNObjEndpoint] stringByAppendingFormat:@"%@",[[self class] objectClassName]]
|
||||||
parameters:[self getObject]
|
parameters:[self getJSONObject]
|
||||||
success:^(NSURLSessionDataTask * _Nonnull _task, id _Nullable _responseObject) {
|
success:^(NSURLSessionDataTask * _Nonnull _task, id _Nullable _responseObject) {
|
||||||
if (success) {
|
if (success) {
|
||||||
success(_task,_responseObject);
|
success(_task,_responseObject);
|
||||||
|
|||||||
@ -18,8 +18,12 @@
|
|||||||
@dynamic JSON;
|
@dynamic JSON;
|
||||||
@dynamic singleInstance;
|
@dynamic singleInstance;
|
||||||
|
|
||||||
|
+ (PNObjectModel* _Nonnull) objectModel {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
+ (NSArray * _Nonnull) protectedProperties {
|
+ (NSArray * _Nonnull) protectedProperties {
|
||||||
return @[@"JSON",@"subClassDelegate",@"objectModel",@"objectMapping"];
|
return @[@"JSON",@"subClassDelegate",@"objectModel",@"objectMapping",@"singleInstance"];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)populateObjectFromJSON:(id _Nullable)JSON
|
- (void)populateObjectFromJSON:(id _Nullable)JSON
|
||||||
@ -45,18 +49,13 @@
|
|||||||
mappedJSONKey = mappingValue;
|
mappedJSONKey = mappingValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if there is mapping for the property
|
|
||||||
if([self isObjNull:mappedJSONKey]) {
|
if ([[PNObject protectedProperties] containsObject:propertyName]) {
|
||||||
// No mapping so just continue
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Get JSON value for the mapped key
|
// Get JSON value for the mapped key
|
||||||
id value = [JSON valueForKeyPath:propertyName];
|
id value = [JSON valueForKeyPath:propertyName];
|
||||||
if([self isObjNull:value]) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
((void (^)())@{
|
((void (^)())@{
|
||||||
@ -89,9 +88,8 @@
|
|||||||
[self setValue:@(val) forKey:propertyName];
|
[self setValue:@(val) forKey:propertyName];
|
||||||
},
|
},
|
||||||
@"NSString" : ^{
|
@"NSString" : ^{
|
||||||
NSString *val = [NSString stringWithFormat:@"%@", value];
|
if (![self isObjNull:value]) {
|
||||||
if (![self isObjNull:val]) {
|
[self setValue:value forKey:propertyName];
|
||||||
[self setValue:val forKey:propertyName];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
@ -136,7 +134,6 @@
|
|||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL)isObjNull:(id _Nullable)obj
|
- (BOOL)isObjNull:(id _Nullable)obj
|
||||||
|
|||||||
@ -28,11 +28,13 @@
|
|||||||
|
|
||||||
@property (nonatomic, strong) NSString * _Nonnull objID;
|
@property (nonatomic, strong) NSString * _Nonnull objID;
|
||||||
@property (nonatomic, strong) NSDate * _Nonnull createdAt;
|
@property (nonatomic, strong) NSDate * _Nonnull createdAt;
|
||||||
@property (nonatomic, strong, getter=getObject) NSDictionary * _Nonnull objectMapping;
|
@property (nonatomic, strong, getter=getJSONObject) NSDictionary * _Nonnull objectMapping;
|
||||||
@property (nonatomic, assign) id<PNObjectSubclassing> _Nonnull subClassDelegate;
|
@property (nonatomic, assign) id<PNObjectSubclassing> _Nonnull subClassDelegate;
|
||||||
|
|
||||||
- (_Nullable instancetype) initWithJSON:( NSDictionary * _Nonnull) JSON;
|
- (_Nullable instancetype) initWithJSON:( NSDictionary * _Nonnull) JSON;
|
||||||
|
|
||||||
- (id _Nonnull) saveLocally;
|
- (id _Nonnull) saveLocally;
|
||||||
|
|
||||||
|
- (BOOL) autoRemoveLocally;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|||||||
@ -43,10 +43,14 @@
|
|||||||
|
|
||||||
if (self) {
|
if (self) {
|
||||||
if ([[self class] isSubclassOfClass:[PNObject class]]) {
|
if ([[self class] isSubclassOfClass:[PNObject class]]) {
|
||||||
|
|
||||||
NSAssert([[self class] conformsToProtocol:@protocol(PNObjectSubclassing)], @"Subclass object must conform to PNObjectSubclassing");
|
NSAssert([[self class] conformsToProtocol:@protocol(PNObjectSubclassing)], @"Subclass object must conform to PNObjectSubclassing");
|
||||||
|
|
||||||
_objID = [[NSProcessInfo processInfo] globallyUniqueString];
|
_objID = [[NSProcessInfo processInfo] globallyUniqueString];
|
||||||
|
|
||||||
|
_objectModel = [PNObjectModel sharedInstance];
|
||||||
|
[_objectModel setPersistencyDelegate:self];
|
||||||
|
|
||||||
NSMutableDictionary * objectDict = [[NSMutableDictionary alloc] initWithDictionary:[[self class] objcetMapping]];
|
NSMutableDictionary * objectDict = [[NSMutableDictionary alloc] initWithDictionary:[[self class] objcetMapping]];
|
||||||
[objectDict addEntriesFromDictionary:[self PNObjectMapping]];
|
[objectDict addEntriesFromDictionary:[self PNObjectMapping]];
|
||||||
|
|
||||||
@ -56,23 +60,41 @@
|
|||||||
|
|
||||||
_singleInstance = [[self class] singleInstance];
|
_singleInstance = [[self class] singleInstance];
|
||||||
|
|
||||||
_objectModel = [PNObjectModel sharedInstance];
|
|
||||||
[_objectModel setPersistencyDelegate:self];
|
|
||||||
|
|
||||||
_createdAt = [[NSDate date] toLocalTime];
|
_createdAt = [[NSDate date] toLocalTime];
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (_Nullable instancetype) initWithJSON:( NSDictionary * _Nonnull) JSON {
|
- (_Nullable instancetype) initWithJSON:( NSDictionary * _Nonnull) JSON {
|
||||||
self = [self init];
|
self = [super init];
|
||||||
if (self) {
|
if (self) {
|
||||||
|
if ([[self class] isSubclassOfClass:[PNObject class]]) {
|
||||||
|
NSAssert([[self class] conformsToProtocol:@protocol(PNObjectSubclassing)], @"Subclass object must conform to PNObjectSubclassing");
|
||||||
|
|
||||||
|
_objID = [[NSProcessInfo processInfo] globallyUniqueString];
|
||||||
|
|
||||||
|
_objectModel = [PNObjectModel sharedInstance];
|
||||||
|
[_objectModel setPersistencyDelegate:self];
|
||||||
|
|
||||||
|
NSMutableDictionary * objectDict = [[NSMutableDictionary alloc] initWithDictionary:[[self class] objcetMapping]];
|
||||||
|
[objectDict addEntriesFromDictionary:[self PNObjectMapping]];
|
||||||
|
|
||||||
|
_objectMapping = objectDict;
|
||||||
|
|
||||||
|
NSAssert(_objectMapping, @"You must create objectMapping");
|
||||||
|
|
||||||
|
_singleInstance = [[self class] singleInstance];
|
||||||
|
|
||||||
|
_createdAt = [[NSDate date] toLocalTime];
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
NSAssert(_objectMapping, @"You must create objectMapping");
|
NSAssert(_objectMapping, @"You must create objectMapping");
|
||||||
_JSON = [[NSMutableDictionary alloc] initWithDictionary:JSON];
|
_JSON = [[NSMutableDictionary alloc] initWithDictionary:JSON];
|
||||||
|
|
||||||
[self populateObjectFromJSON:JSON];
|
[self populateObjectFromJSON:_JSON];
|
||||||
}
|
}
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
@ -162,7 +184,7 @@
|
|||||||
@"NSArray" : ^{
|
@"NSArray" : ^{
|
||||||
NSMutableArray *arr = [NSMutableArray array];
|
NSMutableArray *arr = [NSMutableArray array];
|
||||||
for(id PNObject in value) {
|
for(id PNObject in value) {
|
||||||
SEL selector = NSSelectorFromString(@"getObject");
|
SEL selector = NSSelectorFromString(@"getJSONObject");
|
||||||
NSInvocation *invocation = [NSInvocation invocationWithMethodSignature: [[PNObject class] instanceMethodSignatureForSelector:selector]];
|
NSInvocation *invocation = [NSInvocation invocationWithMethodSignature: [[PNObject class] instanceMethodSignatureForSelector:selector]];
|
||||||
[invocation setSelector:selector];
|
[invocation setSelector:selector];
|
||||||
[invocation setTarget:PNObject];
|
[invocation setTarget:PNObject];
|
||||||
@ -181,7 +203,7 @@
|
|||||||
PNObject *val = [[NSClassFromString(mappedJSONType) alloc] initWithJSON:JSONObject];
|
PNObject *val = [[NSClassFromString(mappedJSONType) alloc] initWithJSON:JSONObject];
|
||||||
[arr addObject:val];
|
[arr addObject:val];
|
||||||
|
|
||||||
SEL selector = NSSelectorFromString(@"getObject");
|
SEL selector = NSSelectorFromString(@"getJSONObject");
|
||||||
NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:[[PNObject class] instanceMethodSignatureForSelector:selector]];
|
NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:[[PNObject class] instanceMethodSignatureForSelector:selector]];
|
||||||
[invocation setSelector:selector];
|
[invocation setSelector:selector];
|
||||||
[invocation setTarget:value];
|
[invocation setTarget:value];
|
||||||
@ -195,7 +217,7 @@
|
|||||||
}[propertyType] ?: ^{
|
}[propertyType] ?: ^{
|
||||||
BOOL isPNObjectSubclass = [NSClassFromString(propertyType) isSubclassOfClass:[PNObject class]];
|
BOOL isPNObjectSubclass = [NSClassFromString(propertyType) isSubclassOfClass:[PNObject class]];
|
||||||
if(isPNObjectSubclass) {
|
if(isPNObjectSubclass) {
|
||||||
SEL selector = NSSelectorFromString(@"getObject");
|
SEL selector = NSSelectorFromString(@"getJSONObject");
|
||||||
NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:[[PNObject class] instanceMethodSignatureForSelector:selector]];
|
NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:[[PNObject class] instanceMethodSignatureForSelector:selector]];
|
||||||
[invocation setSelector:selector];
|
[invocation setSelector:selector];
|
||||||
[invocation setTarget:value];
|
[invocation setTarget:value];
|
||||||
@ -220,7 +242,7 @@
|
|||||||
return _JSON;
|
return _JSON;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSDictionary* _Nonnull) getObject {
|
- (NSDictionary* _Nonnull) getJSONObject {
|
||||||
return [self reverseMapping];
|
return [self reverseMapping];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -263,6 +285,10 @@
|
|||||||
return [_objectModel saveLocally:self];
|
return [_objectModel saveLocally:self];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (BOOL) autoRemoveLocally {
|
||||||
|
return [_objectModel removeObjectLocally:self];
|
||||||
|
}
|
||||||
|
|
||||||
#pragma mark -
|
#pragma mark -
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|||||||
@ -39,7 +39,7 @@
|
|||||||
*
|
*
|
||||||
* @return <#return value description#>
|
* @return <#return value description#>
|
||||||
*/
|
*/
|
||||||
- (id _Nonnull) removeObjectAndSaveLocally:(id _Nonnull) object;
|
- (BOOL) removeObjectLocally:(id _Nonnull) object;
|
||||||
|
|
||||||
- (id _Nonnull) fetchObjectsWithClass:(Class _Nonnull) class;
|
- (id _Nonnull) fetchObjectsWithClass:(Class _Nonnull) class;
|
||||||
|
|
||||||
|
|||||||
@ -44,7 +44,6 @@ static bool isFirstAccess = YES;
|
|||||||
|
|
||||||
if ([[object class] conformsToProtocol:@protocol(PNObjectSubclassing)]) {
|
if ([[object class] conformsToProtocol:@protocol(PNObjectSubclassing)]) {
|
||||||
|
|
||||||
NSLogDebug(@"%@",[object subClassDelegate]);
|
|
||||||
NSString *className;
|
NSString *className;
|
||||||
//if ([[object subClassDelegate] respondsToSelector:@selector(objectClassName)]) {
|
//if ([[object subClassDelegate] respondsToSelector:@selector(objectClassName)]) {
|
||||||
|
|
||||||
@ -119,6 +118,7 @@ static bool isFirstAccess = YES;
|
|||||||
_fileManager = [PEARFileManager sharedInstatnce];
|
_fileManager = [PEARFileManager sharedInstatnce];
|
||||||
|
|
||||||
[_fileManager setRootDirectory:k_ROOT_DIR_DOCUMENTS];
|
[_fileManager setRootDirectory:k_ROOT_DIR_DOCUMENTS];
|
||||||
|
NSLogDebug(@"%@",[_fileManager getRootDirectoryPath]);
|
||||||
}
|
}
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
@ -160,7 +160,7 @@ static bool isFirstAccess = YES;
|
|||||||
|
|
||||||
if ([(PNObject*) object singleInstance]) {
|
if ([(PNObject*) object singleInstance]) {
|
||||||
|
|
||||||
SEL selector = NSSelectorFromString(@"getObject");
|
SEL selector = NSSelectorFromString(@"getJSONObject");
|
||||||
NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:[[PNObject class] instanceMethodSignatureForSelector:selector]];
|
NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:[[PNObject class] instanceMethodSignatureForSelector:selector]];
|
||||||
[invocation setSelector:selector];
|
[invocation setSelector:selector];
|
||||||
[invocation setTarget:object];
|
[invocation setTarget:object];
|
||||||
@ -198,7 +198,7 @@ static bool isFirstAccess = YES;
|
|||||||
NSMutableArray *objects = [[NSMutableArray alloc] initWithArray:[NSKeyedUnarchiver unarchiveObjectWithData:data]];
|
NSMutableArray *objects = [[NSMutableArray alloc] initWithArray:[NSKeyedUnarchiver unarchiveObjectWithData:data]];
|
||||||
|
|
||||||
|
|
||||||
SEL selector = NSSelectorFromString(@"getObject");
|
SEL selector = NSSelectorFromString(@"getJSONObject");
|
||||||
NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:[[PNObject class] instanceMethodSignatureForSelector:selector]];
|
NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:[[PNObject class] instanceMethodSignatureForSelector:selector]];
|
||||||
[invocation setSelector:selector];
|
[invocation setSelector:selector];
|
||||||
[invocation setTarget:object];
|
[invocation setTarget:object];
|
||||||
@ -226,7 +226,7 @@ static bool isFirstAccess = YES;
|
|||||||
NSMutableArray *objects = [[NSMutableArray alloc] init];
|
NSMutableArray *objects = [[NSMutableArray alloc] init];
|
||||||
|
|
||||||
|
|
||||||
SEL selector = NSSelectorFromString(@"getObject");
|
SEL selector = NSSelectorFromString(@"getJSONObject");
|
||||||
NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:[[PNObject class] instanceMethodSignatureForSelector:selector]];
|
NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:[[PNObject class] instanceMethodSignatureForSelector:selector]];
|
||||||
[invocation setSelector:selector];
|
[invocation setSelector:selector];
|
||||||
[invocation setTarget:object];
|
[invocation setTarget:object];
|
||||||
@ -259,19 +259,19 @@ static bool isFirstAccess = YES;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (id _Nonnull) removeObjectAndSaveLocally:(id _Nonnull) object {
|
- (BOOL) removeObjectLocally:(id _Nonnull) object {
|
||||||
BOOL isPNObjectSubclass = [[object class] isSubclassOfClass:[PNObject class]];
|
BOOL isPNObjectSubclass = [[object class] isSubclassOfClass:[PNObject class]];
|
||||||
|
|
||||||
if(isPNObjectSubclass) {
|
if(isPNObjectSubclass) {
|
||||||
|
|
||||||
if ([[object class] conformsToProtocol:@protocol(PNObjectSubclassing)]) {
|
if ([[object class] conformsToProtocol:@protocol(PNObjectSubclassing)]) {
|
||||||
|
|
||||||
if ([(PNObject*) object singleInstance]) {
|
if ([self issetPNObjectModelForObject:object]) {
|
||||||
|
return [_fileManager deletePath:[self objectName:object]];
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|||||||
@ -77,15 +77,17 @@ static bool isFirstAccess = YES;
|
|||||||
if (isFirstAccess) {
|
if (isFirstAccess) {
|
||||||
[self doesNotRecognizeSelector:_cmd];
|
[self doesNotRecognizeSelector:_cmd];
|
||||||
}
|
}
|
||||||
self = [super init];
|
|
||||||
if (self) {
|
|
||||||
[self setSubClassDelegate:self];
|
|
||||||
|
|
||||||
super.JSON = [super.objectModel fetchObjectsWithClass:[self class]];
|
NSDictionary *savedUser = [[PNObjectModel sharedInstance] fetchObjectsWithClass:[self class]];
|
||||||
|
|
||||||
if(super.JSON){
|
if (savedUser) {
|
||||||
[super populateObjectFromJSON:super.JSON];
|
self = [super initWithJSON:savedUser];
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
self = [super init];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (self) {
|
||||||
}
|
}
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user