Skip to content

Commit f069165

Browse files
committed
* adjusted JSONCache to compile for OSX
1 parent a9a78c8 commit f069165

7 files changed

Lines changed: 57 additions & 14 deletions

File tree

JSONModel/JSONModelNetworking/JSONCache.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,11 @@ extern float kImmediatelyExpire;
5959
* ... the cache is already working with them with the config you've set ...
6060
* </pre>
6161
*
62-
* NB: If you are persisting your cache between app sessions (the common case) for apps
62+
* **NB**: If you are persisting your cache between app sessions (the common case) for apps
6363
* with offline mode, do not forget after configuring the cache, to load the cached files
6464
* from the device's disc: [[JSONCache sharedCache] loadCacheFromDisc]
6565
*
66-
* If you want to check what are the cached objects in the cache right now:
66+
* If you want to check what's in the cache right now:
6767
* <pre>
6868
* NSLog(@"Cache: %@", [JSONCache sharedCache]);
6969
* </pre>
@@ -73,12 +73,12 @@ extern float kImmediatelyExpire;
7373
*/
7474
@interface JSONCache : NSObject
7575

76-
/** @name Shared singleton instance */
76+
/** @name Access shared cache */
7777
/** Shared instance for you to use */
7878
+(instancetype)sharedCache;
7979

8080
#pragma mark - network status
81-
/** @name JSONCache network status */
81+
/** @name Check network status */
8282
/**
8383
* Indicates whether a network connection is available.
8484
*
@@ -190,7 +190,7 @@ extern float kImmediatelyExpire;
190190
-(void)purgeCache;
191191

192192
#pragma mark - helpers
193-
/** @name Client helper methods */
193+
/** @name Get the etag header name */
194194
/**
195195
* Returns either "ETag" or "X-ETag" depending on the value of **isUsingXdHTTPHeaderNames**
196196
*

JSONModel/JSONModelNetworking/JSONCache.m

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -370,12 +370,13 @@ -(void)updateConnectivity
370370
return;
371371
}
372372
}
373-
373+
#if TARGET_OS_IPHONE
374374
if ((flags & kSCNetworkReachabilityFlagsIsWWAN) == kSCNetworkReachabilityFlagsIsWWAN)
375375
{
376376
_isOnline = YES;
377377
return;
378378
}
379+
#endif
379380
}
380381
}
381382

@@ -419,7 +420,7 @@ -(NSString*)MD5:(NSString*)string
419420

420421
const char *cStr = [string UTF8String];
421422
unsigned char result[16];
422-
CC_MD5( cStr, strlen(cStr), result );
423+
CC_MD5( cStr, (CC_LONG)strlen(cStr), result );
423424
return [NSString stringWithFormat:
424425
@"%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x",
425426
result[0], result[1], result[2], result[3],
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
//
2+
// JSONCacheTests.h
3+
// JSONModelDemo_iOS
4+
//
5+
// Created by Marin Todorov on 4/9/13.
6+
// Copyright (c) 2013 Underplot ltd. All rights reserved.
7+
//
8+
9+
#import <SenTestingKit/SenTestingKit.h>
10+
11+
@interface JSONCacheTests : SenTestCase
12+
13+
@end
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
//
2+
// JSONCacheTests.m
3+
// JSONModelDemo_iOS
4+
//
5+
// Created by Marin Todorov on 4/9/13.
6+
// Copyright (c) 2013 Underplot ltd. All rights reserved.
7+
//
8+
9+
#import "JSONCacheTests.h"
10+
11+
@implementation JSONCacheTests
12+
13+
@end

JSONModelDemo_OSX.xcodeproj/project.pbxproj

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,8 @@
8686
9C66E007168CF09A0015CCDF /* JSONKeyMapper.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C66DFF3168CF09A0015CCDF /* JSONKeyMapper.m */; };
8787
9C66E008168CF09A0015CCDF /* JSONValueTransformer.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C66DFF5168CF09A0015CCDF /* JSONValueTransformer.m */; };
8888
9C66E009168CF09A0015CCDF /* JSONValueTransformer.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C66DFF5168CF09A0015CCDF /* JSONValueTransformer.m */; };
89+
9C72A49B171444EF0047C6AE /* JSONCacheTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C72A49A171444EF0047C6AE /* JSONCacheTests.m */; };
90+
9C72A49D171447F70047C6AE /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9C72A49C171447F70047C6AE /* SystemConfiguration.framework */; };
8991
9C735D67170B717F00FF96F5 /* JSONAPITests.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C735D66170B717F00FF96F5 /* JSONAPITests.m */; };
9092
9C735D6D170B7A2D00FF96F5 /* RpcRequestModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C735D6C170B7A2D00FF96F5 /* RpcRequestModel.m */; };
9193
9C735D73170C048C00FF96F5 /* InitFromWebTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C735D72170C048C00FF96F5 /* InitFromWebTests.m */; };
@@ -212,6 +214,9 @@
212214
9C66DFF3168CF09A0015CCDF /* JSONKeyMapper.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JSONKeyMapper.m; sourceTree = "<group>"; };
213215
9C66DFF4168CF09A0015CCDF /* JSONValueTransformer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSONValueTransformer.h; sourceTree = "<group>"; };
214216
9C66DFF5168CF09A0015CCDF /* JSONValueTransformer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JSONValueTransformer.m; sourceTree = "<group>"; };
217+
9C72A499171444EF0047C6AE /* JSONCacheTests.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSONCacheTests.h; sourceTree = "<group>"; };
218+
9C72A49A171444EF0047C6AE /* JSONCacheTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JSONCacheTests.m; sourceTree = "<group>"; };
219+
9C72A49C171447F70047C6AE /* SystemConfiguration.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SystemConfiguration.framework; path = System/Library/Frameworks/SystemConfiguration.framework; sourceTree = SDKROOT; };
215220
9C735D65170B717F00FF96F5 /* JSONAPITests.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSONAPITests.h; sourceTree = "<group>"; };
216221
9C735D66170B717F00FF96F5 /* JSONAPITests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JSONAPITests.m; sourceTree = "<group>"; };
217222
9C735D6B170B7A2D00FF96F5 /* RpcRequestModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RpcRequestModel.h; sourceTree = "<group>"; };
@@ -272,6 +277,7 @@
272277
isa = PBXFrameworksBuildPhase;
273278
buildActionMask = 2147483647;
274279
files = (
280+
9C72A49D171447F70047C6AE /* SystemConfiguration.framework in Frameworks */,
275281
9C97441C168CF255004DA333 /* Cocoa.framework in Frameworks */,
276282
);
277283
runOnlyForDeploymentPostprocessing = 0;
@@ -341,6 +347,8 @@
341347
9C735D66170B717F00FF96F5 /* JSONAPITests.m */,
342348
9C735D71170C048C00FF96F5 /* InitFromWebTests.h */,
343349
9C735D72170C048C00FF96F5 /* InitFromWebTests.m */,
350+
9C72A499171444EF0047C6AE /* JSONCacheTests.h */,
351+
9C72A49A171444EF0047C6AE /* JSONCacheTests.m */,
344352
);
345353
path = UnitTests;
346354
sourceTree = "<group>";
@@ -511,6 +519,7 @@
511519
9CC27C901689B7BE008B5411 /* Frameworks */ = {
512520
isa = PBXGroup;
513521
children = (
522+
9C72A49C171447F70047C6AE /* SystemConfiguration.framework */,
514523
9C97441D168CF264004DA333 /* Cocoa.framework */,
515524
9C97441B168CF255004DA333 /* Cocoa.framework */,
516525
9CC27CAF1689B7BE008B5411 /* SenTestingKit.framework */,
@@ -777,6 +786,7 @@
777786
9C735D67170B717F00FF96F5 /* JSONAPITests.m in Sources */,
778787
9C735D6D170B7A2D00FF96F5 /* RpcRequestModel.m in Sources */,
779788
9C735D73170C048C00FF96F5 /* InitFromWebTests.m in Sources */,
789+
9C72A49B171444EF0047C6AE /* JSONCacheTests.m in Sources */,
780790
);
781791
runOnlyForDeploymentPostprocessing = 0;
782792
};

JSONModelDemo_iOS.xcodeproj/project.pbxproj

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@
8181
9C66E035168CF0AA0015CCDF /* JSONKeyMapper.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C66E021168CF0AA0015CCDF /* JSONKeyMapper.m */; };
8282
9C66E036168CF0AA0015CCDF /* JSONValueTransformer.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C66E023168CF0AA0015CCDF /* JSONValueTransformer.m */; };
8383
9C66E037168CF0AA0015CCDF /* JSONValueTransformer.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C66E023168CF0AA0015CCDF /* JSONValueTransformer.m */; };
84+
9C72A498171444C50047C6AE /* JSONCacheTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C72A497171444C50047C6AE /* JSONCacheTests.m */; };
8485
9C735D64170B716300FF96F5 /* JSONAPITests.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C735D63170B716300FF96F5 /* JSONAPITests.m */; };
8586
9C735D6A170B781000FF96F5 /* RpcRequestModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C735D69170B781000FF96F5 /* RpcRequestModel.m */; };
8687
9C735D70170C007900FF96F5 /* InitFromWebTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C735D6F170C007900FF96F5 /* InitFromWebTests.m */; };
@@ -237,6 +238,8 @@
237238
9C66E021168CF0AA0015CCDF /* JSONKeyMapper.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JSONKeyMapper.m; sourceTree = "<group>"; };
238239
9C66E022168CF0AA0015CCDF /* JSONValueTransformer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSONValueTransformer.h; sourceTree = "<group>"; };
239240
9C66E023168CF0AA0015CCDF /* JSONValueTransformer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JSONValueTransformer.m; sourceTree = "<group>"; };
241+
9C72A496171444C50047C6AE /* JSONCacheTests.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSONCacheTests.h; sourceTree = "<group>"; };
242+
9C72A497171444C50047C6AE /* JSONCacheTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JSONCacheTests.m; sourceTree = "<group>"; };
240243
9C735D62170B716300FF96F5 /* JSONAPITests.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSONAPITests.h; sourceTree = "<group>"; };
241244
9C735D63170B716300FF96F5 /* JSONAPITests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JSONAPITests.m; sourceTree = "<group>"; };
242245
9C735D68170B781000FF96F5 /* RpcRequestModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RpcRequestModel.h; sourceTree = "<group>"; };
@@ -397,6 +400,8 @@
397400
9C735D63170B716300FF96F5 /* JSONAPITests.m */,
398401
9C735D6E170C007900FF96F5 /* InitFromWebTests.h */,
399402
9C735D6F170C007900FF96F5 /* InitFromWebTests.m */,
403+
9C72A496171444C50047C6AE /* JSONCacheTests.h */,
404+
9C72A497171444C50047C6AE /* JSONCacheTests.m */,
400405
);
401406
path = UnitTests;
402407
sourceTree = "<group>";
@@ -955,6 +960,7 @@
955960
9C735D64170B716300FF96F5 /* JSONAPITests.m in Sources */,
956961
9C735D6A170B781000FF96F5 /* RpcRequestModel.m in Sources */,
957962
9C735D70170C007900FF96F5 /* InitFromWebTests.m in Sources */,
963+
9C72A498171444C50047C6AE /* JSONCacheTests.m in Sources */,
958964
);
959965
runOnlyForDeploymentPostprocessing = 0;
960966
};

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
11
JSONModel
22
====================================
33
------------------------------------
4-
**Magical Data Modelling Framework for JSON**
4+
Magical Data Modelling Framework for JSON
5+
------------------------------------
6+
7+
![JSONModel for iOS and OSX](http://jsonmodel.com/img/jsonmodel_logolike.png)
58

69
JSONModel is a library, which allows rapid creation of smart data models. You can use it in your iOS or OSX apps.
710

811
**JSONModel does NOT pre-write your code** as many other libs do, instead it uses performance optimized code to introspect your model classes at run-time, thus being way more flexible when you need to do changes.
912

10-
[![](http://jsonmodel.com/img/screen_ios.png)](http://jsonmodel.com/img/screen_ios.png)
11-
[![](http://jsonmodel.com/img/screen_osx.png)](http://jsonmodel.com/img/screen_osx.png)
12-
13-
The core task of JSONModel is to help you reduce your Objective-C code to parse and import JSON values to Objective-C objects.
14-
1513
JSONModel automatically introspects your model classes and the structure of your JSON input and reduces drastically the amount of code.
1614

1715
The core task of JSONModel is to import, convert, store and export data - through the JSON data types bottleneck:
1816

1917
[![](http://www.touch-code-magazine.com/img/json.png)](http://www.touch-code-magazine.com/img/json.png)
2018

21-
Besides this core task JSONModel does also a whole bunch of other tasks, to help you **automate as much as possible** working with local or remote JSON data.
19+
Besides this core task JSONModel does also a whole bunch of other tasks, to help you **automate as much as possible** working with local or remote JSON data; it also does provide for you a networking layer, so you don't need to depend on 3rd party networking library (except if you don't want to)
20+
21+
![JSONModel Class schema](http://jsonmodel.com/img/jsonschema.png)
2222

2323
------------------------------------
2424
Requirements

0 commit comments

Comments
 (0)