- Add Class Method PNObjClassName that return che object subclasse name

This commit is contained in:
Giuseppe Nucifora 2016-01-29 10:26:55 +01:00
parent 3956a3d8f0
commit 114f0dbbaf
3 changed files with 13 additions and 0 deletions

View File

@ -50,6 +50,8 @@
[user setLastName:@"Sapienza"];
[user getJSONObject];
NSLog(@"%@",[PNUser PNObjClassName]);
//NSLog(@"%@",userDictionary);
/*

View File

@ -26,6 +26,8 @@
@interface PNObject : NSObject
+ (NSString * _Nonnull) PNObjClassName;
- (_Nullable instancetype) initWithJSON:( NSDictionary * _Nonnull) JSON;
- (id _Nonnull) saveLocally;

View File

@ -50,6 +50,15 @@
#pragma mark -
+ (NSString * _Nonnull) PNObjClassName {
if ([[self class] resolveClassMethod:@selector(objectClassName)]) {
return [[self class] objectClassName];
}
else {
return [[super class] objectClassName];
}
}
- (_Nullable instancetype) init {
self = [super init];