Browse files

Removed JSON framework dependency (Do we really need it?)

- spliting up token response by the means of NSString
- removed JSON framework submodule
  • Loading branch information...
1 parent 2a68a98 commit 0e77bfebb9f5ad4806cdbd7f8818dacec187f678 @stigi stigi committed Sep 1, 2010
Showing with 12 additions and 132 deletions.
  1. +0 −3 .gitmodules
  2. +0 −124 OAuth2Client.xcodeproj/project.pbxproj
  3. +0 −1 Outsourced/JSON-Framework
  4. +12 −4 Sources/OAuth2Client/NXOAuth2AccessToken.m
View
3 .gitmodules
@@ -1,3 +0,0 @@
-[submodule "Outsourced/JSON-Framework"]
- path = Outsourced/JSON-Framework
- url = git://github.com/stig/json-framework.git
View
124 OAuth2Client.xcodeproj/project.pbxproj
@@ -7,7 +7,6 @@
objects = {
/* Begin PBXBuildFile section */
- 9414FE2C122BD6F100852F70 /* libjson.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 9414FE27122BD6E900852F70 /* libjson.a */; };
9429B3AA12267A3100D31807 /* NXOAuth2Client.h in Headers */ = {isa = PBXBuildFile; fileRef = 9429B3A812267A3100D31807 /* NXOAuth2Client.h */; settings = {ATTRIBUTES = (Public, ); }; };
9429B3AB12267A3100D31807 /* NXOAuth2Client.m in Sources */ = {isa = PBXBuildFile; fileRef = 9429B3A912267A3100D31807 /* NXOAuth2Client.m */; };
9429B4D91226987D00D31807 /* NXOAuth2AccessToken.h in Headers */ = {isa = PBXBuildFile; fileRef = 9429B4D71226987D00D31807 /* NXOAuth2AccessToken.h */; settings = {ATTRIBUTES = (Public, ); }; };
@@ -58,53 +57,7 @@
AACBBE4A0F95108600F1A2B1 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AACBBE490F95108600F1A2B1 /* Foundation.framework */; };
/* End PBXBuildFile section */
-/* Begin PBXContainerItemProxy section */
- 9414FE22122BD6E900852F70 /* PBXContainerItemProxy */ = {
- isa = PBXContainerItemProxy;
- containerPortal = 9414FE14122BD6E800852F70 /* JSON.xcodeproj */;
- proxyType = 2;
- remoteGlobalIDString = 53D229810C96121600276605;
- remoteInfo = JSON;
- };
- 9414FE24122BD6E900852F70 /* PBXContainerItemProxy */ = {
- isa = PBXContainerItemProxy;
- containerPortal = 9414FE14122BD6E800852F70 /* JSON.xcodeproj */;
- proxyType = 2;
- remoteGlobalIDString = 53D2298D0C96122A00276605;
- remoteInfo = Tests;
- };
- 9414FE26122BD6E900852F70 /* PBXContainerItemProxy */ = {
- isa = PBXContainerItemProxy;
- containerPortal = 9414FE14122BD6E800852F70 /* JSON.xcodeproj */;
- proxyType = 2;
- remoteGlobalIDString = FE2BBD800D8B0D3900184787;
- remoteInfo = libjson;
- };
- 9414FE28122BD6E900852F70 /* PBXContainerItemProxy */ = {
- isa = PBXContainerItemProxy;
- containerPortal = 9414FE14122BD6E800852F70 /* JSON.xcodeproj */;
- proxyType = 2;
- remoteGlobalIDString = FE2BBDAB0D8B0EE000184787;
- remoteInfo = libjsontests;
- };
- 9414FE2A122BD6E900852F70 /* PBXContainerItemProxy */ = {
- isa = PBXContainerItemProxy;
- containerPortal = 9414FE14122BD6E800852F70 /* JSON.xcodeproj */;
- proxyType = 2;
- remoteGlobalIDString = 53EF4D400DC247B3005F5E6D;
- remoteInfo = bench;
- };
- 9414FE2D122BD6F600852F70 /* PBXContainerItemProxy */ = {
- isa = PBXContainerItemProxy;
- containerPortal = 9414FE14122BD6E800852F70 /* JSON.xcodeproj */;
- proxyType = 1;
- remoteGlobalIDString = FE2BBD7F0D8B0D3900184787;
- remoteInfo = libjson;
- };
-/* End PBXContainerItemProxy section */
-
/* Begin PBXFileReference section */
- 9414FE14122BD6E800852F70 /* JSON.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = JSON.xcodeproj; path = "JSON-Framework/JSON.xcodeproj"; sourceTree = "<group>"; };
9429B3A812267A3100D31807 /* NXOAuth2Client.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NXOAuth2Client.h; sourceTree = "<group>"; };
9429B3A912267A3100D31807 /* NXOAuth2Client.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NXOAuth2Client.m; sourceTree = "<group>"; };
9429B4D71226987D00D31807 /* NXOAuth2AccessToken.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NXOAuth2AccessToken.h; sourceTree = "<group>"; };
@@ -146,7 +99,6 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
- 9414FE2C122BD6F100852F70 /* libjson.a in Frameworks */,
AACBBE4A0F95108600F1A2B1 /* Foundation.framework in Frameworks */,
94E5AC93122C097B00C7021A /* Security.framework in Frameworks */,
);
@@ -166,7 +118,6 @@
0867D691FE84028FC02AAC07 /* OAuth2Client */ = {
isa = PBXGroup;
children = (
- 9414FE10122BD6CC00852F70 /* Outsourced */,
08FB77AEFE84172EC02AAC07 /* Sources */,
0867D69AFE84028FC02AAC07 /* Frameworks */,
034768DFFF38A50411DB9C8B /* Products */,
@@ -194,26 +145,6 @@
path = Sources;
sourceTree = "<group>";
};
- 9414FE10122BD6CC00852F70 /* Outsourced */ = {
- isa = PBXGroup;
- children = (
- 9414FE14122BD6E800852F70 /* JSON.xcodeproj */,
- );
- path = Outsourced;
- sourceTree = "<group>";
- };
- 9414FE15122BD6E800852F70 /* Products */ = {
- isa = PBXGroup;
- children = (
- 9414FE23122BD6E900852F70 /* JSON.framework */,
- 9414FE25122BD6E900852F70 /* Tests.octest */,
- 9414FE27122BD6E900852F70 /* libjson.a */,
- 9414FE29122BD6E900852F70 /* libjsontests.octest */,
- 9414FE2B122BD6E900852F70 /* bench */,
- );
- name = Products;
- sourceTree = "<group>";
- };
9429B38B1226789400D31807 /* OAuth2Client */ = {
isa = PBXGroup;
children = (
@@ -332,7 +263,6 @@
buildRules = (
);
dependencies = (
- 9414FE2E122BD6F600852F70 /* PBXTargetDependency */,
);
name = OAuth2Client;
productName = OAuth2Client;
@@ -353,12 +283,6 @@
mainGroup = 0867D691FE84028FC02AAC07 /* OAuth2Client */;
productRefGroup = 034768DFFF38A50411DB9C8B /* Products */;
projectDirPath = "";
- projectReferences = (
- {
- ProductGroup = 9414FE15122BD6E800852F70 /* Products */;
- ProjectRef = 9414FE14122BD6E800852F70 /* JSON.xcodeproj */;
- },
- );
projectRoot = "";
targets = (
D2AAC07D0554694100DB518D /* OAuth2Client */,
@@ -367,44 +291,6 @@
};
/* End PBXProject section */
-/* Begin PBXReferenceProxy section */
- 9414FE23122BD6E900852F70 /* JSON.framework */ = {
- isa = PBXReferenceProxy;
- fileType = wrapper.framework;
- path = JSON.framework;
- remoteRef = 9414FE22122BD6E900852F70 /* PBXContainerItemProxy */;
- sourceTree = BUILT_PRODUCTS_DIR;
- };
- 9414FE25122BD6E900852F70 /* Tests.octest */ = {
- isa = PBXReferenceProxy;
- fileType = wrapper.cfbundle;
- path = Tests.octest;
- remoteRef = 9414FE24122BD6E900852F70 /* PBXContainerItemProxy */;
- sourceTree = BUILT_PRODUCTS_DIR;
- };
- 9414FE27122BD6E900852F70 /* libjson.a */ = {
- isa = PBXReferenceProxy;
- fileType = archive.ar;
- path = libjson.a;
- remoteRef = 9414FE26122BD6E900852F70 /* PBXContainerItemProxy */;
- sourceTree = BUILT_PRODUCTS_DIR;
- };
- 9414FE29122BD6E900852F70 /* libjsontests.octest */ = {
- isa = PBXReferenceProxy;
- fileType = wrapper.cfbundle;
- path = libjsontests.octest;
- remoteRef = 9414FE28122BD6E900852F70 /* PBXContainerItemProxy */;
- sourceTree = BUILT_PRODUCTS_DIR;
- };
- 9414FE2B122BD6E900852F70 /* bench */ = {
- isa = PBXReferenceProxy;
- fileType = "compiled.mach-o.executable";
- path = bench;
- remoteRef = 9414FE2A122BD6E900852F70 /* PBXContainerItemProxy */;
- sourceTree = BUILT_PRODUCTS_DIR;
- };
-/* End PBXReferenceProxy section */
-
/* Begin PBXResourcesBuildPhase section */
94E5B272122D457400C7021A /* Resources */ = {
isa = PBXResourcesBuildPhase;
@@ -452,14 +338,6 @@
};
/* End PBXSourcesBuildPhase section */
-/* Begin PBXTargetDependency section */
- 9414FE2E122BD6F600852F70 /* PBXTargetDependency */ = {
- isa = PBXTargetDependency;
- name = libjson;
- targetProxy = 9414FE2D122BD6F600852F70 /* PBXContainerItemProxy */;
- };
-/* End PBXTargetDependency section */
-
/* Begin XCBuildConfiguration section */
1DEB921F08733DC00010E9CD /* Debug */ = {
isa = XCBuildConfiguration;
@@ -478,7 +356,6 @@
INSTALL_PATH = /usr/local/lib;
PRODUCT_NAME = OAuth2Client;
SDKROOT = iphoneos3.2;
- USER_HEADER_SEARCH_PATHS = /tmp/JSON.dst/usr/local/include;
};
name = Debug;
};
@@ -495,7 +372,6 @@
INSTALL_PATH = /usr/local/lib;
PRODUCT_NAME = OAuth2Client;
SDKROOT = iphoneos3.2;
- USER_HEADER_SEARCH_PATHS = /tmp/JSON.dst/usr/local/include;
};
name = Release;
};
1 Outsourced/JSON-Framework
@@ -1 +0,0 @@
-Subproject commit 84952bf7ab87f448e0554115dc5f0a2250d97bbc
View
16 Sources/OAuth2Client/NXOAuth2AccessToken.m
@@ -15,17 +15,25 @@
#import "NSString+NXOAuth2.h"
-#import "JSON/JSON.h"
-
@implementation NXOAuth2AccessToken
#pragma mark Lifecycle
+ (id)tokenWithResponseBody:(NSString *)responseBody;
{
- id jsonDict = [responseBody JSONValue];
- NSNumber *expiresIn = [jsonDict objectForKey:@"expires_in"];
+ // do we really need a JSON dependency? We can easily split this up ourselfs
+ responseBody = [[[responseBody stringByReplacingOccurrencesOfString:@"{" withString:@""]
+ stringByReplacingOccurrencesOfString:@"}" withString:@""]
+ stringByReplacingOccurrencesOfString:@"\"" withString:@""];
+ NSMutableDictionary *jsonDict = [NSMutableDictionary dictionary];
+ for (NSString *keyValuePair in [responseBody componentsSeparatedByString:@","]) {
+ NSArray *keyAndValue = [keyValuePair componentsSeparatedByString:@":"];
+ if (keyAndValue.count == 2) {
+ [jsonDict setObject:[keyAndValue objectAtIndex:1] forKey:[keyAndValue objectAtIndex:0]];
+ }
+ }
+ NSString *expiresIn = [jsonDict objectForKey:@"expires_in"];
NSString *anAccessToken = [jsonDict objectForKey:@"access_token"];
NSString *aRefreshToken = [jsonDict objectForKey:@"refresh_token"];

0 comments on commit 0e77bfe

Please sign in to comment.