From f5b0688cdd1eb25bfb5e2f47852997363cd8dab5 Mon Sep 17 00:00:00 2001 From: neil Date: Tue, 19 May 2015 17:36:06 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=89=A9=E5=B1=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- JSONModel.podspec | 4 +-- .../JSONModel+SLYExtension.h | 16 +++++++++ .../JSONModel+SLYExtension.m | 34 +++++++++++++++++++ JSONModelDemo_iOS.xcodeproj/project.pbxproj | 10 ++++-- 4 files changed, 60 insertions(+), 4 deletions(-) create mode 100644 JSONModel/JSONModelCategories/JSONModel+SLYExtension.h create mode 100644 JSONModel/JSONModelCategories/JSONModel+SLYExtension.m diff --git a/JSONModel.podspec b/JSONModel.podspec index 21180781..7b522169 100644 --- a/JSONModel.podspec +++ b/JSONModel.podspec @@ -1,13 +1,13 @@ Pod::Spec.new do |s| s.name = "JSONModel" - s.version = "1.1.1" + s.version = "1.1.2" s.summary = "Magical Data Modelling Framework for JSON. Create rapidly powerful, atomic and smart data model classes." s.homepage = "http://www.jsonmodel.com" s.license = { :type => 'MIT', :file => 'LICENSE_jsonmodel.txt' } s.author = { "Marin Todorov" => "touch-code-magazine@underplot.com" } - s.source = { :git => "https://github.com/icanzilb/JSONModel.git", :tag => "1.1.1" } + s.source = { :git => "git@github.com:shulianyong/JSONModel.git", :tag => "1.1.2" } s.ios.deployment_target = '5.0' s.osx.deployment_target = '10.7' diff --git a/JSONModel/JSONModelCategories/JSONModel+SLYExtension.h b/JSONModel/JSONModelCategories/JSONModel+SLYExtension.h new file mode 100644 index 00000000..f22ba2c0 --- /dev/null +++ b/JSONModel/JSONModelCategories/JSONModel+SLYExtension.h @@ -0,0 +1,16 @@ +// +// JSONModel+SLYExtension.h +// MeiQiReferrer +// +// Created by neil on 15/4/13. +// Copyright (c) 2015年 MeiQi iOS Dev Team. All rights reserved. +// + +#import "JSONModel.h" + +@interface JSONModel (SLYExtension) + +//获取所有的属性 +- (NSDictionary*)classProperties; + +@end diff --git a/JSONModel/JSONModelCategories/JSONModel+SLYExtension.m b/JSONModel/JSONModelCategories/JSONModel+SLYExtension.m new file mode 100644 index 00000000..061aefd3 --- /dev/null +++ b/JSONModel/JSONModelCategories/JSONModel+SLYExtension.m @@ -0,0 +1,34 @@ +// +// JSONModel+SLYExtension.m +// MeiQiReferrer +// +// Created by neil on 15/4/13. +// Copyright (c) 2015年 MeiQi iOS Dev Team. All rights reserved. +// + +#import +#import "JSONModel+SLYExtension.h" + +extern const char * kClassPropertiesKey; + +@interface JSONModel () + +-(void)__setup__; + +@end + +@implementation JSONModel (SLYExtension) + +//获取所有的属性 +- (NSDictionary*)classProperties +{ + NSDictionary* classProperties = objc_getAssociatedObject(self.class, &kClassPropertiesKey); + if (classProperties) + return classProperties; + //if here, the class needs to inspect itself + [self __setup__]; + return [self classProperties]; +} + + +@end diff --git a/JSONModelDemo_iOS.xcodeproj/project.pbxproj b/JSONModelDemo_iOS.xcodeproj/project.pbxproj index 1ba85343..afcb4ddd 100644 --- a/JSONModelDemo_iOS.xcodeproj/project.pbxproj +++ b/JSONModelDemo_iOS.xcodeproj/project.pbxproj @@ -7,11 +7,12 @@ objects = { /* Begin PBXBuildFile section */ - 4A50001D19C5DCCF00C161A0 /* InitWithDataTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 4A50001C19C5DCCF00C161A0 /* InitWithDataTests.m */; }; + 28AAF20D1B0B3AF70006A101 /* JSONModel+SLYExtension.m in Sources */ = {isa = PBXBuildFile; fileRef = 28AAF20C1B0B3AF70006A101 /* JSONModel+SLYExtension.m */; }; 358FD078D3C0D56C77ACD770 /* ExtremeNestingModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 358FDBE28A19497358D1A6DA /* ExtremeNestingModel.m */; }; 358FD179E0B41C47C67713B5 /* InteractionModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 358FDCB3CFE05DBA0DE27E5F /* InteractionModel.m */; }; 358FD61804BD21F41035348E /* ExtremeNestingTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 358FDBA42551FF88466BD5C3 /* ExtremeNestingTests.m */; }; 358FD640BFEAB00349FBBA4A /* DrugModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 358FD25356988AC33EA6A935 /* DrugModel.m */; }; + 4A50001D19C5DCCF00C161A0 /* InitWithDataTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 4A50001C19C5DCCF00C161A0 /* InitWithDataTests.m */; }; 69286BDA17FA280900D1BA81 /* nestedDataWithDictionaryError.json in Resources */ = {isa = PBXBuildFile; fileRef = 69286BD917FA280900D1BA81 /* nestedDataWithDictionaryError.json */; }; 69286BDB17FA280900D1BA81 /* nestedDataWithDictionaryError.json in Resources */ = {isa = PBXBuildFile; fileRef = 69286BD917FA280900D1BA81 /* nestedDataWithDictionaryError.json */; }; 697852FD17D934B5006BFCD0 /* nestedDataWithTypeMismatchOnImages.json in Resources */ = {isa = PBXBuildFile; fileRef = 697852FC17D934B5006BFCD0 /* nestedDataWithTypeMismatchOnImages.json */; }; @@ -156,7 +157,8 @@ /* End PBXContainerItemProxy section */ /* Begin PBXFileReference section */ - 4A50001C19C5DCCF00C161A0 /* InitWithDataTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = InitWithDataTests.m; sourceTree = ""; }; + 28AAF20B1B0B3AF70006A101 /* JSONModel+SLYExtension.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "JSONModel+SLYExtension.h"; sourceTree = ""; }; + 28AAF20C1B0B3AF70006A101 /* JSONModel+SLYExtension.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "JSONModel+SLYExtension.m"; sourceTree = ""; }; 358FD25356988AC33EA6A935 /* DrugModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DrugModel.m; sourceTree = ""; }; 358FD7AD55FD213CBAAB460F /* ExtremeNestingModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ExtremeNestingModel.h; sourceTree = ""; }; 358FD807C3E86F5DC4058645 /* ExtremeNestingTests.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ExtremeNestingTests.h; sourceTree = ""; }; @@ -165,6 +167,7 @@ 358FDBE28A19497358D1A6DA /* ExtremeNestingModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ExtremeNestingModel.m; sourceTree = ""; }; 358FDCB3CFE05DBA0DE27E5F /* InteractionModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = InteractionModel.m; sourceTree = ""; }; 358FDED5E028AA00D3E6564D /* InteractionModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InteractionModel.h; sourceTree = ""; }; + 4A50001C19C5DCCF00C161A0 /* InitWithDataTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = InitWithDataTests.m; sourceTree = ""; }; 69286BD917FA280900D1BA81 /* nestedDataWithDictionaryError.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = nestedDataWithDictionaryError.json; sourceTree = ""; }; 697852FC17D934B5006BFCD0 /* nestedDataWithTypeMismatchOnImages.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = nestedDataWithTypeMismatchOnImages.json; sourceTree = ""; }; 697852FE17D93546006BFCD0 /* nestedDataWithTypeMismatchOnImagesObject.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = nestedDataWithTypeMismatchOnImagesObject.json; sourceTree = ""; }; @@ -493,6 +496,8 @@ 9C66E014168CF0AA0015CCDF /* JSONModelCategories */ = { isa = PBXGroup; children = ( + 28AAF20B1B0B3AF70006A101 /* JSONModel+SLYExtension.h */, + 28AAF20C1B0B3AF70006A101 /* JSONModel+SLYExtension.m */, 9C66E015168CF0AA0015CCDF /* NSArray+JSONModel.h */, 9C66E016168CF0AA0015CCDF /* NSArray+JSONModel.m */, ); @@ -925,6 +930,7 @@ 9C55AF0F189033AE004EBD8A /* GitHubRepoModel.m in Sources */, 9CBBBFB1166BBB05008B4326 /* MyDataModel.m in Sources */, 9CBBBFB5166BBB21008B4326 /* StorageViewController.m in Sources */, + 28AAF20D1B0B3AF70006A101 /* JSONModel+SLYExtension.m in Sources */, 9C0D0240166E6BBF001EA645 /* KivaViewControllerNetworking.m in Sources */, 9C55AF0E18903300004EBD8A /* ReposModel.m in Sources */, 9C66E024168CF0AA0015CCDF /* JSONModel.m in Sources */, From 4cff1f44cb854ea75c24dedc2cbc2376dea7819f Mon Sep 17 00:00:00 2001 From: neil Date: Wed, 20 May 2015 09:45:14 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E6=9B=B4=E6=94=B9=E6=97=A5=E5=BF=97?= =?UTF-8?q?=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- JSONModel/JSONModel/JSONModel.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/JSONModel/JSONModel/JSONModel.h b/JSONModel/JSONModel/JSONModel.h index 56f4cfa3..523daa24 100644 --- a/JSONModel/JSONModel/JSONModel.h +++ b/JSONModel/JSONModel/JSONModel.h @@ -21,7 +21,7 @@ #import "JSONKeyMapper.h" ///////////////////////////////////////////////////////////////////////////////////////////// -#if TARGET_IPHONE_SIMULATOR +#if DEBUG #define JMLog( s, ... ) NSLog( @"[%@:%d] %@", [[NSString stringWithUTF8String:__FILE__] \ lastPathComponent], __LINE__, [NSString stringWithFormat:(s), ##__VA_ARGS__] ) #else