Skip to content

Commit

Permalink
Merge pull request nfarina#11 from marramgrass/deprecate-jsonkit
Browse files Browse the repository at this point in the history
Replace JSONKit with NSJSONSerialization.
  • Loading branch information
nfarina committed Apr 21, 2014
2 parents 64dad81 + 8ae188b commit 5458fa3
Show file tree
Hide file tree
Showing 10 changed files with 148 additions and 3,332 deletions.
33 changes: 18 additions & 15 deletions Feeds.xcodeproj/project.pbxproj
Expand Up @@ -113,7 +113,6 @@
01524F4514BFB45F00913D84 /* TrelloAccount.m in Sources */ = {isa = PBXBuildFile; fileRef = 01524F4414BFB45F00913D84 /* TrelloAccount.m */; };
015D788F13C6394600BCD7C4 /* Popover.html in Resources */ = {isa = PBXBuildFile; fileRef = 015D788E13C6394600BCD7C4 /* Popover.html */; };
015E0ED814475D2E000A611D /* AccountCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 015E0ED714475D2E000A611D /* AccountCell.m */; };
015E0EE614478DB6000A611D /* JSONKit.m in Sources */ = {isa = PBXBuildFile; fileRef = 015E0EE514478DB6000A611D /* JSONKit.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
0181D973152492D400D1E78B /* BasecampNextAccount.m in Sources */ = {isa = PBXBuildFile; fileRef = 0181D972152492D400D1E78B /* BasecampNextAccount.m */; };
01937C8313A03F5000BCE1D4 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 01937C8213A03F5000BCE1D4 /* Cocoa.framework */; };
01937C8D13A03F5000BCE1D4 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 01937C8B13A03F5000BCE1D4 /* InfoPlist.strings */; };
Expand Down Expand Up @@ -159,6 +158,9 @@
01F616F313AEAA2700EBB24E /* PreferencesController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 01F616F113AEAA2600EBB24E /* PreferencesController.xib */; };
01F64A2B14C2318B00AAABD7 /* BeanstalkAccount.m in Sources */ = {isa = PBXBuildFile; fileRef = 01F64A2A14C2318B00AAABD7 /* BeanstalkAccount.m */; };
01F7120714F9551700A32AB9 /* NSDate+TimeAgo.m in Sources */ = {isa = PBXBuildFile; fileRef = 01F7120614F9498000A32AB9 /* NSDate+TimeAgo.m */; };
4DDB2F0218FF310500AD815D /* NSData+ObjectFromJSONData.m in Sources */ = {isa = PBXBuildFile; fileRef = 4DDB2F0118FF310500AD815D /* NSData+ObjectFromJSONData.m */; };
4DDB2F05190002B600AD815D /* NSString+ObjectFromJSONString.m in Sources */ = {isa = PBXBuildFile; fileRef = 4DDB2F04190002B600AD815D /* NSString+ObjectFromJSONString.m */; };
4DDB2F08190002CB00AD815D /* NSDictionary+JSONString.m in Sources */ = {isa = PBXBuildFile; fileRef = 4DDB2F07190002CB00AD815D /* NSDictionary+JSONString.m */; };
F6155F9B173BFC270016C528 /* ZootoolAccount.m in Sources */ = {isa = PBXBuildFile; fileRef = F6155F9A173BFC270016C528 /* ZootoolAccount.m */; };
F6155FA2173BFD9A0016C528 /* Zootool.png in Resources */ = {isa = PBXBuildFile; fileRef = F6155F9C173BFD9A0016C528 /* Zootool.png */; };
F6155FA3173BFD9A0016C528 /* Zootool@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = F6155F9D173BFD9A0016C528 /* Zootool@2x.png */; };
Expand Down Expand Up @@ -311,8 +313,6 @@
015D788E13C6394600BCD7C4 /* Popover.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; name = Popover.html; path = Popover/Popover.html; sourceTree = "<group>"; };
015E0ED614475D2E000A611D /* AccountCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AccountCell.h; sourceTree = "<group>"; };
015E0ED714475D2E000A611D /* AccountCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AccountCell.m; sourceTree = "<group>"; };
015E0EE414478DB6000A611D /* JSONKit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSONKit.h; sourceTree = "<group>"; };
015E0EE514478DB6000A611D /* JSONKit.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JSONKit.m; sourceTree = "<group>"; };
0181D971152492D400D1E78B /* BasecampNextAccount.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BasecampNextAccount.h; sourceTree = "<group>"; };
0181D972152492D400D1E78B /* BasecampNextAccount.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = BasecampNextAccount.m; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objc; };
01937C7E13A03F5000BCE1D4 /* Feeds.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Feeds.app; sourceTree = BUILT_PRODUCTS_DIR; };
Expand Down Expand Up @@ -389,6 +389,12 @@
01F64A2A14C2318B00AAABD7 /* BeanstalkAccount.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = BeanstalkAccount.m; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objc; };
01F7120514F9498000A32AB9 /* NSDate+TimeAgo.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "NSDate+TimeAgo.h"; sourceTree = "<group>"; };
01F7120614F9498000A32AB9 /* NSDate+TimeAgo.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "NSDate+TimeAgo.m"; sourceTree = "<group>"; };
4DDB2F0018FF310500AD815D /* NSData+ObjectFromJSONData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSData+ObjectFromJSONData.h"; sourceTree = "<group>"; };
4DDB2F0118FF310500AD815D /* NSData+ObjectFromJSONData.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSData+ObjectFromJSONData.m"; sourceTree = "<group>"; };
4DDB2F03190002B600AD815D /* NSString+ObjectFromJSONString.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSString+ObjectFromJSONString.h"; sourceTree = "<group>"; };
4DDB2F04190002B600AD815D /* NSString+ObjectFromJSONString.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSString+ObjectFromJSONString.m"; sourceTree = "<group>"; };
4DDB2F06190002CB00AD815D /* NSDictionary+JSONString.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSDictionary+JSONString.h"; sourceTree = "<group>"; };
4DDB2F07190002CB00AD815D /* NSDictionary+JSONString.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSDictionary+JSONString.m"; sourceTree = "<group>"; };
F6155F99173BFC270016C528 /* ZootoolAccount.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ZootoolAccount.h; sourceTree = "<group>"; };
F6155F9A173BFC270016C528 /* ZootoolAccount.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ZootoolAccount.m; sourceTree = "<group>"; };
F6155F9C173BFD9A0016C528 /* Zootool.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Zootool.png; sourceTree = "<group>"; };
Expand Down Expand Up @@ -490,6 +496,12 @@
0133CEA21530973E00CF6647 /* NSAlert+Foreground.m */,
01A93AAC1652B36A00B96B79 /* NSString+EmailValidation.h */,
01A93AAD1652B36A00B96B79 /* NSString+EmailValidation.m */,
4DDB2F0018FF310500AD815D /* NSData+ObjectFromJSONData.h */,
4DDB2F0118FF310500AD815D /* NSData+ObjectFromJSONData.m */,
4DDB2F03190002B600AD815D /* NSString+ObjectFromJSONString.h */,
4DDB2F04190002B600AD815D /* NSString+ObjectFromJSONString.m */,
4DDB2F06190002CB00AD815D /* NSDictionary+JSONString.h */,
4DDB2F07190002CB00AD815D /* NSDictionary+JSONString.m */,
);
name = Helpers;
sourceTree = "<group>";
Expand Down Expand Up @@ -722,7 +734,6 @@
013BE6CB15E146F80002F51E /* Lumberjack */,
01937CB313A05A6300BCE1D4 /* XML Document */,
01937CB113A05A3E00BCE1D4 /* Web Request */,
01B2BE7B13C4E89D00304D6A /* JSONKit */,
019EE0C4147023B800B67B74 /* DDHotKey */,
014147A71486B258000D63E5 /* Hpple */,
);
Expand All @@ -749,16 +760,6 @@
path = Libraries/DDHotKey;
sourceTree = "<group>";
};
01B2BE7B13C4E89D00304D6A /* JSONKit */ = {
isa = PBXGroup;
children = (
015E0EE414478DB6000A611D /* JSONKit.h */,
015E0EE514478DB6000A611D /* JSONKit.m */,
);
name = JSONKit;
path = Libraries/JSONKit;
sourceTree = "<group>";
};
01D7CB8113B02C74001B133A /* Controllers */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -979,14 +980,14 @@
01518F7E13C54F480043AB98 /* CG+Geometry.m in Sources */,
0125C6CD13C7C8B10006BB1A /* NSView+PrintHierarchy.m in Sources */,
015E0ED814475D2E000A611D /* AccountCell.m in Sources */,
015E0EE614478DB6000A611D /* JSONKit.m in Sources */,
019EE0DC147023B800B67B74 /* DDHotKeyCenter.m in Sources */,
019EE0F2147044CA00B67B74 /* LoginItems.m in Sources */,
014147A01486B019000D63E5 /* UserVoiceAccount.m in Sources */,
014147AE1486B258000D63E5 /* TFHpple.m in Sources */,
014147AF1486B258000D63E5 /* TFHppleElement.m in Sources */,
014147B01486B258000D63E5 /* XPathQuery.m in Sources */,
014147B81486B575000D63E5 /* NSString+English.m in Sources */,
4DDB2F0218FF310500AD815D /* NSData+ObjectFromJSONData.m in Sources */,
014147BB1486BAB5000D63E5 /* ISO8601DateFormatter.m in Sources */,
01524F4514BFB45F00913D84 /* TrelloAccount.m in Sources */,
01F64A2B14C2318B00AAABD7 /* BeanstalkAccount.m in Sources */,
Expand All @@ -998,13 +999,15 @@
01BD35E2154D985200170BDD /* ZendeskAccount.m in Sources */,
012734BE15DFFB4E00512361 /* RSSAtomAccount.m in Sources */,
013BE6ED15E14F7E0002F51E /* DDFileLogger.m in Sources */,
4DDB2F08190002CB00AD815D /* NSDictionary+JSONString.m in Sources */,
013BE6EE15E14F7E0002F51E /* DDLog.m in Sources */,
013BE6EF15E14F7E0002F51E /* DDTTYLogger.m in Sources */,
013BE6F015E14F7E0002F51E /* DDASLLogger.m in Sources */,
01F2ABB615E176D500AE57F0 /* PivotalTrackerAccount.m in Sources */,
013B1AA815E703F3008E9ACB /* NSDate+InternetDateTime.m in Sources */,
01A93AAE1652B36A00B96B79 /* NSString+EmailValidation.m in Sources */,
F6155F9B173BFC270016C528 /* ZootoolAccount.m in Sources */,
4DDB2F05190002B600AD815D /* NSString+ObjectFromJSONString.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
4 changes: 3 additions & 1 deletion Feeds/Feeds-Prefix.pch
Expand Up @@ -13,7 +13,6 @@
#import "NSDate+InternetDateTime.h"
#import "SMWebRequest.h"
#import "SMXMLDocument.h"
#import "JSONKit.h"
#import "NSArray+Linqish.h"
#import "NSString+EntityDecoding.h"
#import "NSString+Base64.h"
Expand All @@ -30,6 +29,9 @@
#import "NSString+URLArgument.h"
#import "NSAlert+Foreground.h"
#import "NSString+EmailValidation.h"
#import "NSData+ObjectFromJSONData.h"
#import "NSString+ObjectFromJSONString.h"
#import "NSDictionary+JSONString.h"
#endif

#include "Prefs.h"
Expand Down
15 changes: 15 additions & 0 deletions Feeds/NSData+ObjectFromJSONData.h
@@ -0,0 +1,15 @@
//
// NSData+ObjectFromJSONData.h
// Feeds
//
// Created by Mark Goody on 16/04/2014.
// Copyright (c) 2014 Spotlight Mobile. All rights reserved.
//

#import <Foundation/Foundation.h>

@interface NSData (ObjectFromJSONData)

- (id)objectFromJSONData;

@end
27 changes: 27 additions & 0 deletions Feeds/NSData+ObjectFromJSONData.m
@@ -0,0 +1,27 @@
//
// NSData+ObjectFromJSONData.m
// Feeds
//
// Created by Mark Goody on 16/04/2014.
// Copyright (c) 2014 Spotlight Mobile. All rights reserved.
//

#import "NSData+ObjectFromJSONData.h"

@implementation NSData (ObjectFromJSONData)

- (id)objectFromJSONData
{
NSError *decodingError = nil;
id object = [NSJSONSerialization JSONObjectWithData:self
options:NSJSONReadingAllowFragments
error:&decodingError];

if (object == nil && decodingError != nil) {
NSLog(@"Error decoding JSON data");
}

return object;
}

@end
15 changes: 15 additions & 0 deletions Feeds/NSDictionary+JSONString.h
@@ -0,0 +1,15 @@
//
// NSDictionary+JSONString.h
// Feeds
//
// Created by Mark Goody on 17/04/2014.
// Copyright (c) 2014 Spotlight Mobile. All rights reserved.
//

#import <Foundation/Foundation.h>

@interface NSDictionary (JSONString)

- (NSString *)JSONString;

@end
34 changes: 34 additions & 0 deletions Feeds/NSDictionary+JSONString.m
@@ -0,0 +1,34 @@
//
// NSDictionary+JSONString.m
// Feeds
//
// Created by Mark Goody on 17/04/2014.
// Copyright (c) 2014 Spotlight Mobile. All rights reserved.
//

#import "NSDictionary+JSONString.h"

@implementation NSDictionary (JSONString)

- (NSString *)JSONString
{
NSError *encodingError = nil;
NSData *jsonData = [NSJSONSerialization dataWithJSONObject:self
options:0
error:&encodingError];

if (jsonData == nil && encodingError != nil) {
NSLog(@"Error encoding JSON data for dictionary: %@", encodingError.localizedDescription);
}

NSString *jsonString = nil;
if (jsonData != nil) {
jsonString = [[NSString alloc] initWithBytes:jsonData.bytes
length:jsonData.length
encoding:NSUTF8StringEncoding];
}

return jsonString;
}

@end
15 changes: 15 additions & 0 deletions Feeds/NSString+ObjectFromJSONString.h
@@ -0,0 +1,15 @@
//
// NSString+ObjectFromJSONString.h
// Feeds
//
// Created by Mark Goody on 17/04/2014.
// Copyright (c) 2014 Spotlight Mobile. All rights reserved.
//

#import <Foundation/Foundation.h>

@interface NSString (ObjectFromJSONString)

- (id)objectFromJSONString;

@end
21 changes: 21 additions & 0 deletions Feeds/NSString+ObjectFromJSONString.m
@@ -0,0 +1,21 @@
//
// NSString+ObjectFromJSONString.m
// Feeds
//
// Created by Mark Goody on 17/04/2014.
// Copyright (c) 2014 Spotlight Mobile. All rights reserved.
//

#import "NSString+ObjectFromJSONString.h"
#import "NSData+ObjectFromJSONData.h"

@implementation NSString (ObjectFromJSONString)

- (id)objectFromJSONString
{
NSData *jsonData = [self dataUsingEncoding:NSUTF8StringEncoding];

return [jsonData objectFromJSONData];
}

@end

0 comments on commit 5458fa3

Please sign in to comment.