Skip to content
Browse files

Initial commit.

  • Loading branch information...
0 parents commit 046fd6400a496bf0c127f2c2f9f123692ef0b160 @adamjernst committed Oct 12, 2011
1 .gitignore
@@ -0,0 +1 @@
+xcuserdata
17 AEURLConnection/AEURLConnection.h
@@ -0,0 +1,17 @@
+//
+// AEURLConnection.h
+// AEURLExample
+//
+// Created by Adam Ernst on 10/12/11.
+// Copyright (c) 2011 cosmicsoft. All rights reserved.
+//
+
+#import <Foundation/Foundation.h>
+
+@interface AEURLConnection : NSObject
+
++ (void)sendAsynchronousRequest:(NSURLRequest *)request
+ queue:(NSOperationQueue*)queue
+ completionHandler:(void (^)(NSURLResponse*, NSData*, NSError*))handler;
+
+@end
265 AEURLConnection/AEURLConnection.m
@@ -0,0 +1,265 @@
+//
+// AEURLConnection.m
+// AEURLExample
+//
+// Created by Adam Ernst on 10/12/11.
+// Copyright (c) 2011 cosmicsoft. All rights reserved.
+//
+
+#import "AEURLConnection.h"
+
+
+@interface AEURLConnectionRequest : NSObject
+- (id)initWithRequest:(NSURLRequest *)request
+ queue:(NSOperationQueue *)queue
+ completionHandler:handler;
+@property (nonatomic, retain, readonly) NSURLRequest *request;
+@property (nonatomic, retain, readonly) NSOperationQueue *queue;
+
+// handler is readwrite so that we can nil it out after calling it,
+// to ensure it is released on |queue| and not on the network thread.
+@property (nonatomic, copy, readwrite) void (^handler)(NSURLResponse*, NSData*, NSError*);
+
+@property (nonatomic, retain, readwrite) NSURLConnection *connection;
+@property (nonatomic, retain, readwrite) NSURLResponse *response;
+@property (nonatomic, retain, readwrite) NSMutableData *data;
+@end
+
+
+@interface AEURLConnectionManager : NSObject {
+ NSThread *_networkRequestThread;
+ NSMutableArray *_executingRequests;
+}
++ (AEURLConnectionManager *)sharedManager;
+- (void)startRequest:(AEURLConnectionRequest *)req;
+@end
+
+
+@implementation AEURLConnection
+
++ (void)sendAsynchronousRequest:(NSURLRequest *)request
+ queue:(NSOperationQueue*)queue
+ completionHandler:(void (^)(NSURLResponse*, NSData*, NSError*))handler {
+ AEURLConnectionRequest *req = [[AEURLConnectionRequest alloc] initWithRequest:request queue:queue completionHandler:handler];
+ [[AEURLConnectionManager sharedManager] startRequest:req];
+ [request release];
+}
+
+@end
+
+
+@implementation AEURLConnectionManager
+
+static AEURLConnectionManager *sharedManager = nil;
+
++ (AEURLConnectionManager *)sharedManager {
+ static dispatch_once_t oncePredicate;
+ dispatch_once(&oncePredicate, ^{
+ sharedManager = [[AEURLConnectionManager alloc] init];
+ });
+ return sharedManager;
+}
+
+- (void)networkRequestThreadEntryPoint:(id)__unused object {
+ do {
+ NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
+ [[NSRunLoop currentRunLoop] run];
+ [pool drain];
+ } while (YES);
+}
+
+- (id)init {
+ self = [super init];
+ if (self) {
+ _executingRequests = [[NSMutableArray alloc] init];
+
+ _networkRequestThread = [[NSThread alloc] initWithTarget:self selector:@selector(networkRequestThreadEntryPoint:) object:nil];
+ [_networkRequestThread setThreadPriority:0.1];
+ [_networkRequestThread start];
+
+ }
+ return self;
+}
+
+- (void)dealloc {
+ [_networkRequestThread release];
+ [_executingRequests release];
+ [super dealloc];
+}
+
+- (void)startRequest:(AEURLConnectionRequest *)req {
+ // Can be called from any thread.
+ [self performSelector:@selector(networkThreadStartRequest:)
+ onThread:_networkRequestThread
+ withObject:req
+ waitUntilDone:NO];
+}
+
+#define EXPECT_NETWORK_THREAD NSAssert([[NSThread currentThread] isEqual:_networkRequestThread], @"Expected network thread")
+
+- (void)networkThreadStartRequest:(AEURLConnectionRequest *)req {
+ EXPECT_NETWORK_THREAD;
+
+ // When we get here, |req| should have been freshly created and so its
+ // |connection|, |response|, and |data| properties should all be nil.
+ NSAssert([req connection] == nil && [req response] == nil && [req data] == nil,
+ @"Async request started with invalid state");
+
+ NSURLConnection *connection = [[NSURLConnection alloc] initWithRequest:[req request]
+ delegate:self
+ startImmediately:NO];
+ [req setConnection:connection];
+ [_executingRequests addObject:req];
+
+ // Now that the request is safely initialized with |connection| and
+ // stored in |_executingRequests|, start it on the network thread.
+ [connection scheduleInRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode];
+ [connection start];
+}
+
+- (AEURLConnectionRequest *)executingRequestForConnection:(NSURLConnection *)connection {
+ for (AEURLConnectionRequest *req in _executingRequests) {
+ if ([req connection] == connection) {
+ return req;
+ }
+ }
+ NSAssert(false, @"Couldn't find executing request for a given connection");
+ return nil;
+}
+
+#pragma mark - NSURLConnectionDelegate
+
+- (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response {
+ EXPECT_NETWORK_THREAD;
+
+ AEURLConnectionRequest *req = [self executingRequestForConnection:connection];
+
+ // Reset the request's data. From the docs for
+ // connection:didReceiveResponse:, we read:
+
+ // In rare cases, for example in the case of an HTTP load where the
+ // content type of the load data is multipart/x-mixed-replace,
+ // the delegate will receive more than one
+ // connection:didReceiveResponse: message. In the event this
+ // occurs, delegates should discard all data previously delivered
+ // by connection:didReceiveData:, and should be prepared to handle
+ // the, potentially different, MIME type reported by the newly
+ // reported URL response.
+
+ [req setData:[NSMutableData data]];
+ [req setResponse:response];
+}
+
+- (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data {
+ EXPECT_NETWORK_THREAD;
+
+ AEURLConnectionRequest *req = [self executingRequestForConnection:connection];
+ // We strongly expect that [req data] is not nil. However I stop
+ // short of asserting it, because according to the docs:
+
+ // Zero or more connection:didReceiveResponse: messages will be
+ // sent to the delegate before receiving a connection:didReceiveData:
+ // message. The only case where connection:didReceiveResponse: is
+ // not sent to a delegate is when the protocol implementation
+ // encounters an error before a response could be created.
+
+ // I am not entirely clear on when you might receive data without
+ // first receiving a response. If that happens, though, just drop
+ // the data on the floor; since [req data] is nil, that happens
+ // automatically.
+ [[req data] appendData:data];
+}
+
+- (void)executeHandlerForConnection:(NSURLConnection *)connection error:(NSError *)error {
+ AEURLConnectionRequest *req = [self executingRequestForConnection:connection];
+
+ // It is very important that |handler| is deallocated in the context of
+ // |queue|, since doing so has the very nice property of solving the thorny
+ // Deallocation Problem:
+ // http://developer.apple.com/library/ios/#technotes/tn2109/_index.html#//apple_ref/doc/uid/DTS40010274-CH1-SUBSECTION11#//apple_ref/doc/uid/DTS40010274-CH1-SUBSECTION11
+ // Note that:
+ // - You might create a block that captures |handler|, separately from
+ // adding it to the queue, and call setHandler:nil between creating that
+ // block and adding it to the queue, in an attempt to ensure |handler|
+ // is deallocated on |queue|. However this won't work since the block you
+ // create will be stack-allocated, and thus won't retain |handler|
+ // until you copy the block. When you call setHandler:nil the handler
+ // will be deallocated, with the stack-allocated block left holding
+ // a bad reference.
+ // If you copy the block, though, you'll be right back at square
+ // one: you have to release it after adding it to the queue, but then
+ // you race with the block's completion on |queue| for releasing the
+ // last reference to the block.
+ // - If you just naively reference [req handler] in the block, |req| itself
+ // will be captured. Again, however, you need to release |req| after
+ // either copying the block or adding it to the queue, introducing
+ // the same race condition.
+
+ // So, create a __block variable with a copy of the handler. This prevents
+ // any kind of variable capture for |handler| itself.
+ __block void (^handler)(NSURLResponse *, NSData *, NSError *) = [[req handler] copy];
+ // Now call setHandler:nil on |req|. This should release our last retaining
+ // reference to |handler| EXCEPT for the __block variable.
+ [req setHandler:nil];
+ // Now |handler| is at +1 retain count. Have it release on |queue| after
+ // executing. That guarantees our last reference is released on |queue|.
+
+ // Note that the block below captures |req|. That is OK since |req| no
+ // longer has a reference to |handler| (since we called setHandler:nil).
+
+ [[req queue] addOperationWithBlock:^{
+ handler([req response], error ? nil : [req data], error);
+ [handler release];
+ }];
+
+ // Don't remove |req| from |_executingRequests| until this point. Since
+ // the array is the last retaining reference to |req|, removing it sooner
+ // will deallocate |req| (and cause us to crash when we try to access its
+ // properties).
+ [_executingRequests removeObject:req];
+}
+
+- (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error {
+ EXPECT_NETWORK_THREAD;
+ [self executeHandlerForConnection:connection error:error];
+}
+
+- (void)connectionDidFinishLoading:(NSURLConnection *)connection {
+ EXPECT_NETWORK_THREAD;
+ [self executeHandlerForConnection:connection error:nil];
+}
+
+@end
+
+
+@implementation AEURLConnectionRequest
+
+@synthesize request=_request;
+@synthesize queue=_queue;
+@synthesize handler=_handler;
+
+@synthesize connection=_connection;
+@synthesize response=_response;
+@synthesize data=_data;
+
+- (id)initWithRequest:(NSURLRequest *)request queue:(NSOperationQueue *)queue completionHandler:(id)handler {
+ self = [super init];
+ if (self) {
+ _request = [request retain];
+ _queue = [queue retain];
+ _handler = [handler copy];
+ }
+ return self;
+}
+
+- (void)dealloc {
+ [_request release];
+ [_queue release];
+ [_handler release];
+ [_response release];
+ [_data release];
+ [super dealloc];
+}
+
+@end
+
470 Example/AEURLExample.xcodeproj/project.pbxproj
@@ -0,0 +1,470 @@
+// !$*UTF8*$!
+{
+ archiveVersion = 1;
+ classes = {
+ };
+ objectVersion = 46;
+ objects = {
+
+/* Begin PBXBuildFile section */
+ C4C186871445FF9C003DBCC0 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C4C186861445FF9C003DBCC0 /* UIKit.framework */; };
+ C4C186891445FF9C003DBCC0 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C4C186881445FF9C003DBCC0 /* Foundation.framework */; };
+ C4C1868B1445FF9C003DBCC0 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C4C1868A1445FF9C003DBCC0 /* CoreGraphics.framework */; };
+ C4C186911445FF9C003DBCC0 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = C4C1868F1445FF9C003DBCC0 /* InfoPlist.strings */; };
+ C4C186931445FF9C003DBCC0 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = C4C186921445FF9C003DBCC0 /* main.m */; };
+ C4C186971445FF9C003DBCC0 /* AEAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = C4C186961445FF9C003DBCC0 /* AEAppDelegate.m */; };
+ C4C1869A1445FF9C003DBCC0 /* AEViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = C4C186991445FF9C003DBCC0 /* AEViewController.m */; };
+ C4C1869D1445FF9C003DBCC0 /* AEViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = C4C1869B1445FF9C003DBCC0 /* AEViewController.xib */; };
+ C4C186A51445FF9C003DBCC0 /* SenTestingKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C4C186A41445FF9C003DBCC0 /* SenTestingKit.framework */; };
+ C4C186A61445FF9C003DBCC0 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C4C186861445FF9C003DBCC0 /* UIKit.framework */; };
+ C4C186A71445FF9C003DBCC0 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C4C186881445FF9C003DBCC0 /* Foundation.framework */; };
+ C4C186AF1445FF9C003DBCC0 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = C4C186AD1445FF9C003DBCC0 /* InfoPlist.strings */; };
+ C4C186B21445FF9C003DBCC0 /* AEURLExampleTests.m in Sources */ = {isa = PBXBuildFile; fileRef = C4C186B11445FF9C003DBCC0 /* AEURLExampleTests.m */; };
+ C4C186C31445FFD7003DBCC0 /* AEURLConnection.m in Sources */ = {isa = PBXBuildFile; fileRef = C4C186C21445FFD7003DBCC0 /* AEURLConnection.m */; };
+ C4C186C41445FFD7003DBCC0 /* AEURLConnection.m in Sources */ = {isa = PBXBuildFile; fileRef = C4C186C21445FFD7003DBCC0 /* AEURLConnection.m */; };
+ C4C186CB144615CF003DBCC0 /* JSONKit.m in Sources */ = {isa = PBXBuildFile; fileRef = C4C186CA144615CF003DBCC0 /* JSONKit.m */; };
+ C4C186CC144615CF003DBCC0 /* JSONKit.m in Sources */ = {isa = PBXBuildFile; fileRef = C4C186CA144615CF003DBCC0 /* JSONKit.m */; };
+/* End PBXBuildFile section */
+
+/* Begin PBXContainerItemProxy section */
+ C4C186A81445FF9C003DBCC0 /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = C4C186791445FF9C003DBCC0 /* Project object */;
+ proxyType = 1;
+ remoteGlobalIDString = C4C186811445FF9C003DBCC0;
+ remoteInfo = AEURLExample;
+ };
+/* End PBXContainerItemProxy section */
+
+/* Begin PBXFileReference section */
+ C4C186821445FF9C003DBCC0 /* AEURLExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = AEURLExample.app; sourceTree = BUILT_PRODUCTS_DIR; };
+ C4C186861445FF9C003DBCC0 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };
+ C4C186881445FF9C003DBCC0 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
+ C4C1868A1445FF9C003DBCC0 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; };
+ C4C1868E1445FF9C003DBCC0 /* AEURLExample-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "AEURLExample-Info.plist"; sourceTree = "<group>"; };
+ C4C186901445FF9C003DBCC0 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; };
+ C4C186921445FF9C003DBCC0 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
+ C4C186941445FF9C003DBCC0 /* AEURLExample-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "AEURLExample-Prefix.pch"; sourceTree = "<group>"; };
+ C4C186951445FF9C003DBCC0 /* AEAppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AEAppDelegate.h; sourceTree = "<group>"; };
+ C4C186961445FF9C003DBCC0 /* AEAppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AEAppDelegate.m; sourceTree = "<group>"; };
+ C4C186981445FF9C003DBCC0 /* AEViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AEViewController.h; sourceTree = "<group>"; };
+ C4C186991445FF9C003DBCC0 /* AEViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AEViewController.m; sourceTree = "<group>"; };
+ C4C1869C1445FF9C003DBCC0 /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/AEViewController.xib; sourceTree = "<group>"; };
+ C4C186A31445FF9C003DBCC0 /* AEURLExampleTests.octest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = AEURLExampleTests.octest; sourceTree = BUILT_PRODUCTS_DIR; };
+ C4C186A41445FF9C003DBCC0 /* SenTestingKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SenTestingKit.framework; path = Library/Frameworks/SenTestingKit.framework; sourceTree = DEVELOPER_DIR; };
+ C4C186AC1445FF9C003DBCC0 /* AEURLExampleTests-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "AEURLExampleTests-Info.plist"; sourceTree = "<group>"; };
+ C4C186AE1445FF9C003DBCC0 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; };
+ C4C186B01445FF9C003DBCC0 /* AEURLExampleTests.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AEURLExampleTests.h; sourceTree = "<group>"; };
+ C4C186B11445FF9C003DBCC0 /* AEURLExampleTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AEURLExampleTests.m; sourceTree = "<group>"; };
+ C4C186C11445FFD7003DBCC0 /* AEURLConnection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AEURLConnection.h; sourceTree = "<group>"; };
+ C4C186C21445FFD7003DBCC0 /* AEURLConnection.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AEURLConnection.m; sourceTree = "<group>"; };
+ C4C186C9144615CF003DBCC0 /* JSONKit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSONKit.h; sourceTree = "<group>"; };
+ C4C186CA144615CF003DBCC0 /* JSONKit.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JSONKit.m; sourceTree = "<group>"; };
+/* End PBXFileReference section */
+
+/* Begin PBXFrameworksBuildPhase section */
+ C4C1867F1445FF9C003DBCC0 /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ C4C186871445FF9C003DBCC0 /* UIKit.framework in Frameworks */,
+ C4C186891445FF9C003DBCC0 /* Foundation.framework in Frameworks */,
+ C4C1868B1445FF9C003DBCC0 /* CoreGraphics.framework in Frameworks */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ C4C1869F1445FF9C003DBCC0 /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ C4C186A51445FF9C003DBCC0 /* SenTestingKit.framework in Frameworks */,
+ C4C186A61445FF9C003DBCC0 /* UIKit.framework in Frameworks */,
+ C4C186A71445FF9C003DBCC0 /* Foundation.framework in Frameworks */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXFrameworksBuildPhase section */
+
+/* Begin PBXGroup section */
+ C4C186771445FF9C003DBCC0 = {
+ isa = PBXGroup;
+ children = (
+ C4C186BF1445FFCB003DBCC0 /* AEURLConnection */,
+ C4C1868C1445FF9C003DBCC0 /* AEURLExample */,
+ C4C186AA1445FF9C003DBCC0 /* AEURLExampleTests */,
+ C4C186851445FF9C003DBCC0 /* Frameworks */,
+ C4C186831445FF9C003DBCC0 /* Products */,
+ );
+ sourceTree = "<group>";
+ };
+ C4C186831445FF9C003DBCC0 /* Products */ = {
+ isa = PBXGroup;
+ children = (
+ C4C186821445FF9C003DBCC0 /* AEURLExample.app */,
+ C4C186A31445FF9C003DBCC0 /* AEURLExampleTests.octest */,
+ );
+ name = Products;
+ sourceTree = "<group>";
+ };
+ C4C186851445FF9C003DBCC0 /* Frameworks */ = {
+ isa = PBXGroup;
+ children = (
+ C4C186861445FF9C003DBCC0 /* UIKit.framework */,
+ C4C186881445FF9C003DBCC0 /* Foundation.framework */,
+ C4C1868A1445FF9C003DBCC0 /* CoreGraphics.framework */,
+ C4C186A41445FF9C003DBCC0 /* SenTestingKit.framework */,
+ );
+ name = Frameworks;
+ sourceTree = "<group>";
+ };
+ C4C1868C1445FF9C003DBCC0 /* AEURLExample */ = {
+ isa = PBXGroup;
+ children = (
+ C4C186C9144615CF003DBCC0 /* JSONKit.h */,
+ C4C186CA144615CF003DBCC0 /* JSONKit.m */,
+ C4C186951445FF9C003DBCC0 /* AEAppDelegate.h */,
+ C4C186961445FF9C003DBCC0 /* AEAppDelegate.m */,
+ C4C186981445FF9C003DBCC0 /* AEViewController.h */,
+ C4C186991445FF9C003DBCC0 /* AEViewController.m */,
+ C4C1869B1445FF9C003DBCC0 /* AEViewController.xib */,
+ C4C1868D1445FF9C003DBCC0 /* Supporting Files */,
+ );
+ path = AEURLExample;
+ sourceTree = "<group>";
+ };
+ C4C1868D1445FF9C003DBCC0 /* Supporting Files */ = {
+ isa = PBXGroup;
+ children = (
+ C4C1868E1445FF9C003DBCC0 /* AEURLExample-Info.plist */,
+ C4C1868F1445FF9C003DBCC0 /* InfoPlist.strings */,
+ C4C186921445FF9C003DBCC0 /* main.m */,
+ C4C186941445FF9C003DBCC0 /* AEURLExample-Prefix.pch */,
+ );
+ name = "Supporting Files";
+ sourceTree = "<group>";
+ };
+ C4C186AA1445FF9C003DBCC0 /* AEURLExampleTests */ = {
+ isa = PBXGroup;
+ children = (
+ C4C186B01445FF9C003DBCC0 /* AEURLExampleTests.h */,
+ C4C186B11445FF9C003DBCC0 /* AEURLExampleTests.m */,
+ C4C186AB1445FF9C003DBCC0 /* Supporting Files */,
+ );
+ path = AEURLExampleTests;
+ sourceTree = "<group>";
+ };
+ C4C186AB1445FF9C003DBCC0 /* Supporting Files */ = {
+ isa = PBXGroup;
+ children = (
+ C4C186AC1445FF9C003DBCC0 /* AEURLExampleTests-Info.plist */,
+ C4C186AD1445FF9C003DBCC0 /* InfoPlist.strings */,
+ );
+ name = "Supporting Files";
+ sourceTree = "<group>";
+ };
+ C4C186BF1445FFCB003DBCC0 /* AEURLConnection */ = {
+ isa = PBXGroup;
+ children = (
+ C4C186C11445FFD7003DBCC0 /* AEURLConnection.h */,
+ C4C186C21445FFD7003DBCC0 /* AEURLConnection.m */,
+ );
+ name = AEURLConnection;
+ path = ../AEURLConnection;
+ sourceTree = "<group>";
+ };
+/* End PBXGroup section */
+
+/* Begin PBXNativeTarget section */
+ C4C186811445FF9C003DBCC0 /* AEURLExample */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = C4C186B51445FF9C003DBCC0 /* Build configuration list for PBXNativeTarget "AEURLExample" */;
+ buildPhases = (
+ C4C1867E1445FF9C003DBCC0 /* Sources */,
+ C4C1867F1445FF9C003DBCC0 /* Frameworks */,
+ C4C186801445FF9C003DBCC0 /* Resources */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ );
+ name = AEURLExample;
+ productName = AEURLExample;
+ productReference = C4C186821445FF9C003DBCC0 /* AEURLExample.app */;
+ productType = "com.apple.product-type.application";
+ };
+ C4C186A21445FF9C003DBCC0 /* AEURLExampleTests */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = C4C186B81445FF9C003DBCC0 /* Build configuration list for PBXNativeTarget "AEURLExampleTests" */;
+ buildPhases = (
+ C4C1869E1445FF9C003DBCC0 /* Sources */,
+ C4C1869F1445FF9C003DBCC0 /* Frameworks */,
+ C4C186A01445FF9C003DBCC0 /* Resources */,
+ C4C186A11445FF9C003DBCC0 /* ShellScript */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ C4C186A91445FF9C003DBCC0 /* PBXTargetDependency */,
+ );
+ name = AEURLExampleTests;
+ productName = AEURLExampleTests;
+ productReference = C4C186A31445FF9C003DBCC0 /* AEURLExampleTests.octest */;
+ productType = "com.apple.product-type.bundle";
+ };
+/* End PBXNativeTarget section */
+
+/* Begin PBXProject section */
+ C4C186791445FF9C003DBCC0 /* Project object */ = {
+ isa = PBXProject;
+ attributes = {
+ LastUpgradeCheck = 0420;
+ ORGANIZATIONNAME = cosmicsoft;
+ };
+ buildConfigurationList = C4C1867C1445FF9C003DBCC0 /* Build configuration list for PBXProject "AEURLExample" */;
+ compatibilityVersion = "Xcode 3.2";
+ developmentRegion = English;
+ hasScannedForEncodings = 0;
+ knownRegions = (
+ en,
+ );
+ mainGroup = C4C186771445FF9C003DBCC0;
+ productRefGroup = C4C186831445FF9C003DBCC0 /* Products */;
+ projectDirPath = "";
+ projectRoot = "";
+ targets = (
+ C4C186811445FF9C003DBCC0 /* AEURLExample */,
+ C4C186A21445FF9C003DBCC0 /* AEURLExampleTests */,
+ );
+ };
+/* End PBXProject section */
+
+/* Begin PBXResourcesBuildPhase section */
+ C4C186801445FF9C003DBCC0 /* Resources */ = {
+ isa = PBXResourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ C4C186911445FF9C003DBCC0 /* InfoPlist.strings in Resources */,
+ C4C1869D1445FF9C003DBCC0 /* AEViewController.xib in Resources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ C4C186A01445FF9C003DBCC0 /* Resources */ = {
+ isa = PBXResourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ C4C186AF1445FF9C003DBCC0 /* InfoPlist.strings in Resources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXResourcesBuildPhase section */
+
+/* Begin PBXShellScriptBuildPhase section */
+ C4C186A11445FF9C003DBCC0 /* ShellScript */ = {
+ isa = PBXShellScriptBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ inputPaths = (
+ );
+ outputPaths = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ shellPath = /bin/sh;
+ shellScript = "# Run the unit tests in this test bundle.\n\"${SYSTEM_DEVELOPER_DIR}/Tools/RunUnitTests\"\n";
+ };
+/* End PBXShellScriptBuildPhase section */
+
+/* Begin PBXSourcesBuildPhase section */
+ C4C1867E1445FF9C003DBCC0 /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ C4C186931445FF9C003DBCC0 /* main.m in Sources */,
+ C4C186971445FF9C003DBCC0 /* AEAppDelegate.m in Sources */,
+ C4C1869A1445FF9C003DBCC0 /* AEViewController.m in Sources */,
+ C4C186C31445FFD7003DBCC0 /* AEURLConnection.m in Sources */,
+ C4C186CB144615CF003DBCC0 /* JSONKit.m in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ C4C1869E1445FF9C003DBCC0 /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ C4C186B21445FF9C003DBCC0 /* AEURLExampleTests.m in Sources */,
+ C4C186C41445FFD7003DBCC0 /* AEURLConnection.m in Sources */,
+ C4C186CC144615CF003DBCC0 /* JSONKit.m in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXSourcesBuildPhase section */
+
+/* Begin PBXTargetDependency section */
+ C4C186A91445FF9C003DBCC0 /* PBXTargetDependency */ = {
+ isa = PBXTargetDependency;
+ target = C4C186811445FF9C003DBCC0 /* AEURLExample */;
+ targetProxy = C4C186A81445FF9C003DBCC0 /* PBXContainerItemProxy */;
+ };
+/* End PBXTargetDependency section */
+
+/* Begin PBXVariantGroup section */
+ C4C1868F1445FF9C003DBCC0 /* InfoPlist.strings */ = {
+ isa = PBXVariantGroup;
+ children = (
+ C4C186901445FF9C003DBCC0 /* en */,
+ );
+ name = InfoPlist.strings;
+ sourceTree = "<group>";
+ };
+ C4C1869B1445FF9C003DBCC0 /* AEViewController.xib */ = {
+ isa = PBXVariantGroup;
+ children = (
+ C4C1869C1445FF9C003DBCC0 /* en */,
+ );
+ name = AEViewController.xib;
+ sourceTree = "<group>";
+ };
+ C4C186AD1445FF9C003DBCC0 /* InfoPlist.strings */ = {
+ isa = PBXVariantGroup;
+ children = (
+ C4C186AE1445FF9C003DBCC0 /* en */,
+ );
+ name = InfoPlist.strings;
+ sourceTree = "<group>";
+ };
+/* End PBXVariantGroup section */
+
+/* Begin XCBuildConfiguration section */
+ C4C186B31445FF9C003DBCC0 /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ ARCHS = "$(ARCHS_STANDARD_32_BIT)";
+ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
+ COPY_PHASE_STRIP = NO;
+ GCC_C_LANGUAGE_STANDARD = gnu99;
+ GCC_DYNAMIC_NO_PIC = NO;
+ GCC_OPTIMIZATION_LEVEL = 0;
+ GCC_PREPROCESSOR_DEFINITIONS = (
+ "DEBUG=1",
+ "$(inherited)",
+ );
+ GCC_SYMBOLS_PRIVATE_EXTERN = NO;
+ GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
+ GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES;
+ GCC_WARN_ABOUT_RETURN_TYPE = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ IPHONEOS_DEPLOYMENT_TARGET = 5.0;
+ SDKROOT = iphoneos;
+ };
+ name = Debug;
+ };
+ C4C186B41445FF9C003DBCC0 /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ ARCHS = "$(ARCHS_STANDARD_32_BIT)";
+ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
+ COPY_PHASE_STRIP = YES;
+ GCC_C_LANGUAGE_STANDARD = gnu99;
+ GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
+ GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES;
+ GCC_WARN_ABOUT_RETURN_TYPE = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ IPHONEOS_DEPLOYMENT_TARGET = 5.0;
+ OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1";
+ SDKROOT = iphoneos;
+ VALIDATE_PRODUCT = YES;
+ };
+ name = Release;
+ };
+ C4C186B61445FF9C003DBCC0 /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ GCC_PRECOMPILE_PREFIX_HEADER = YES;
+ GCC_PREFIX_HEADER = "AEURLExample/AEURLExample-Prefix.pch";
+ INFOPLIST_FILE = "AEURLExample/AEURLExample-Info.plist";
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ WRAPPER_EXTENSION = app;
+ };
+ name = Debug;
+ };
+ C4C186B71445FF9C003DBCC0 /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ GCC_PRECOMPILE_PREFIX_HEADER = YES;
+ GCC_PREFIX_HEADER = "AEURLExample/AEURLExample-Prefix.pch";
+ INFOPLIST_FILE = "AEURLExample/AEURLExample-Info.plist";
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ WRAPPER_EXTENSION = app;
+ };
+ name = Release;
+ };
+ C4C186B91445FF9C003DBCC0 /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/AEURLExample.app/AEURLExample";
+ FRAMEWORK_SEARCH_PATHS = (
+ "$(SDKROOT)/Developer/Library/Frameworks",
+ "$(DEVELOPER_LIBRARY_DIR)/Frameworks",
+ );
+ GCC_PRECOMPILE_PREFIX_HEADER = YES;
+ GCC_PREFIX_HEADER = "AEURLExample/AEURLExample-Prefix.pch";
+ INFOPLIST_FILE = "AEURLExampleTests/AEURLExampleTests-Info.plist";
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ TEST_HOST = "$(BUNDLE_LOADER)";
+ WRAPPER_EXTENSION = octest;
+ };
+ name = Debug;
+ };
+ C4C186BA1445FF9C003DBCC0 /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/AEURLExample.app/AEURLExample";
+ FRAMEWORK_SEARCH_PATHS = (
+ "$(SDKROOT)/Developer/Library/Frameworks",
+ "$(DEVELOPER_LIBRARY_DIR)/Frameworks",
+ );
+ GCC_PRECOMPILE_PREFIX_HEADER = YES;
+ GCC_PREFIX_HEADER = "AEURLExample/AEURLExample-Prefix.pch";
+ INFOPLIST_FILE = "AEURLExampleTests/AEURLExampleTests-Info.plist";
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ TEST_HOST = "$(BUNDLE_LOADER)";
+ WRAPPER_EXTENSION = octest;
+ };
+ name = Release;
+ };
+/* End XCBuildConfiguration section */
+
+/* Begin XCConfigurationList section */
+ C4C1867C1445FF9C003DBCC0 /* Build configuration list for PBXProject "AEURLExample" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ C4C186B31445FF9C003DBCC0 /* Debug */,
+ C4C186B41445FF9C003DBCC0 /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+ C4C186B51445FF9C003DBCC0 /* Build configuration list for PBXNativeTarget "AEURLExample" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ C4C186B61445FF9C003DBCC0 /* Debug */,
+ C4C186B71445FF9C003DBCC0 /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+ C4C186B81445FF9C003DBCC0 /* Build configuration list for PBXNativeTarget "AEURLExampleTests" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ C4C186B91445FF9C003DBCC0 /* Debug */,
+ C4C186BA1445FF9C003DBCC0 /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+/* End XCConfigurationList section */
+ };
+ rootObject = C4C186791445FF9C003DBCC0 /* Project object */;
+}
7 Example/AEURLExample.xcodeproj/project.xcworkspace/contents.xcworkspacedata
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Workspace
+ version = "1.0">
+ <FileRef
+ location = "self:AEURLExample.xcodeproj">
+ </FileRef>
+</Workspace>
19 Example/AEURLExample/AEAppDelegate.h
@@ -0,0 +1,19 @@
+//
+// AEAppDelegate.h
+// AEURLExample
+//
+// Created by Adam Ernst on 10/12/11.
+// Copyright (c) 2011 cosmicsoft. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+
+@class AEViewController;
+
+@interface AEAppDelegate : UIResponder <UIApplicationDelegate>
+
+@property (strong, nonatomic) UIWindow *window;
+@property (strong, nonatomic) AEViewController *viewController;
+@property (strong, nonatomic) UINavigationController *navigationController;
+
+@end
35 Example/AEURLExample/AEAppDelegate.m
@@ -0,0 +1,35 @@
+//
+// AEAppDelegate.m
+// AEURLExample
+//
+// Created by Adam Ernst on 10/12/11.
+// Copyright (c) 2011 cosmicsoft. All rights reserved.
+//
+
+#import "AEAppDelegate.h"
+
+#import "AEViewController.h"
+
+@implementation AEAppDelegate
+
+@synthesize window = _window;
+@synthesize viewController = _viewController;
+@synthesize navigationController = _navigationController;
+
+- (void)dealloc {
+ [_window release];
+ [_viewController release];
+ [_navigationController release];
+ [super dealloc];
+}
+
+- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
+ self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
+ self.viewController = [[[AEViewController alloc] initWithNibName:@"AEViewController" bundle:nil] autorelease];;
+ self.navigationController = [[[UINavigationController alloc] initWithRootViewController:self.viewController] autorelease];
+ self.window.rootViewController = self.navigationController;
+ [self.window makeKeyAndVisible];
+ return YES;
+}
+
+@end
40 Example/AEURLExample/AEURLExample-Info.plist
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>CFBundleDevelopmentRegion</key>
+ <string>en</string>
+ <key>CFBundleDisplayName</key>
+ <string>${PRODUCT_NAME}</string>
+ <key>CFBundleExecutable</key>
+ <string>${EXECUTABLE_NAME}</string>
+ <key>CFBundleIconFiles</key>
+ <array/>
+ <key>CFBundleIdentifier</key>
+ <string>com.adamernst.${PRODUCT_NAME:rfc1034identifier}</string>
+ <key>CFBundleInfoDictionaryVersion</key>
+ <string>6.0</string>
+ <key>CFBundleName</key>
+ <string>${PRODUCT_NAME}</string>
+ <key>CFBundlePackageType</key>
+ <string>APPL</string>
+ <key>CFBundleShortVersionString</key>
+ <string>1.0</string>
+ <key>CFBundleSignature</key>
+ <string>????</string>
+ <key>CFBundleVersion</key>
+ <string>1.0</string>
+ <key>LSRequiresIPhoneOS</key>
+ <true/>
+ <key>UIRequiredDeviceCapabilities</key>
+ <array>
+ <string>armv7</string>
+ </array>
+ <key>UISupportedInterfaceOrientations</key>
+ <array>
+ <string>UIInterfaceOrientationPortrait</string>
+ <string>UIInterfaceOrientationLandscapeLeft</string>
+ <string>UIInterfaceOrientationLandscapeRight</string>
+ </array>
+</dict>
+</plist>
14 Example/AEURLExample/AEURLExample-Prefix.pch
@@ -0,0 +1,14 @@
+//
+// Prefix header for all source files of the 'AEURLExample' target in the 'AEURLExample' project
+//
+
+#import <Availability.h>
+
+#ifndef __IPHONE_4_0
+#warning "This project uses features only available in iOS SDK 4.0 and later."
+#endif
+
+#ifdef __OBJC__
+ #import <UIKit/UIKit.h>
+ #import <Foundation/Foundation.h>
+#endif
13 Example/AEURLExample/AEViewController.h
@@ -0,0 +1,13 @@
+//
+// AEViewController.h
+// AEURLExample
+//
+// Created by Adam Ernst on 10/12/11.
+// Copyright (c) 2011 cosmicsoft. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+
+@interface AEViewController : UITableViewController
+
+@end
77 Example/AEURLExample/AEViewController.m
@@ -0,0 +1,77 @@
+//
+// AEViewController.m
+// AEURLExample
+//
+// Created by Adam Ernst on 10/12/11.
+// Copyright (c) 2011 cosmicsoft. All rights reserved.
+//
+
+#import "AEViewController.h"
+#import "AEURLConnection.h"
+#import "JSONKit.h"
+
+@interface AEViewController ()
+@property (nonatomic, retain) NSArray *keys;
+@property (nonatomic, retain) NSDictionary *result;
+@end
+
+@implementation AEViewController
+
+@synthesize keys=_keys;
+@synthesize result=_result;
+
+- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
+ self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
+ if (self) {
+ UIActivityIndicatorView *spinner = [[[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhite] autorelease];
+
+ [self setTitle:@"AEURL Example"];
+ [[self navigationItem] setRightBarButtonItem:[[[UIBarButtonItem alloc] initWithCustomView:spinner] autorelease]];
+ [spinner startAnimating];
+
+ NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"http://graph.facebook.com/137947732957611"]];
+ [AEURLConnection sendAsynchronousRequest:request
+ queue:[NSOperationQueue mainQueue]
+ completionHandler:^(NSURLResponse *response, NSData *data, NSError *error) {
+ [spinner stopAnimating];
+
+ if (error) {
+ [[[[UIAlertView alloc] initWithTitle:[error localizedDescription]
+ message:[error localizedRecoverySuggestion]
+ delegate:nil
+ cancelButtonTitle:@"OK"
+ otherButtonTitles:nil] autorelease] show];
+ } else {
+ id parsedResult = [data objectFromJSONData];
+ [self setKeys:[parsedResult allKeys]];
+ [self setResult:parsedResult];
+ [[self tableView] reloadData];
+ }
+ }];
+ }
+ return self;
+}
+
+- (void)dealloc {
+ [_keys release];
+ [_result release];
+ [super dealloc];
+}
+
+#pragma mark - UITableViewDelegate/UITableViewDataSource
+
+- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
+ return [[self keys] count];
+}
+
+- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
+ id key = [[self keys] objectAtIndex:[indexPath row]];
+ id value = [[self result] objectForKey:key];
+
+ UITableViewCell *cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue2 reuseIdentifier:nil] autorelease];
+ [[cell textLabel] setText:[key description]];
+ [[cell detailTextLabel] setText:[value description]];
+ return cell;
+}
+
+@end
251 Example/AEURLExample/JSONKit.h
@@ -0,0 +1,251 @@
+//
+// JSONKit.h
+// http://github.com/johnezang/JSONKit
+// Dual licensed under either the terms of the BSD License, or alternatively
+// under the terms of the Apache License, Version 2.0, as specified below.
+//
+
+/*
+ Copyright (c) 2011, John Engelhart
+
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ * Neither the name of the Zang Industries nor the names of its
+ contributors may be used to endorse or promote products derived from
+ this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
+ TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+/*
+ Copyright 2011 John Engelhart
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+*/
+
+#include <stddef.h>
+#include <stdint.h>
+#include <limits.h>
+#include <TargetConditionals.h>
+#include <AvailabilityMacros.h>
+
+#ifdef __OBJC__
+#import <Foundation/NSArray.h>
+#import <Foundation/NSData.h>
+#import <Foundation/NSDictionary.h>
+#import <Foundation/NSError.h>
+#import <Foundation/NSObjCRuntime.h>
+#import <Foundation/NSString.h>
+#endif // __OBJC__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+// For Mac OS X < 10.5.
+#ifndef NSINTEGER_DEFINED
+#define NSINTEGER_DEFINED
+#if defined(__LP64__) || defined(NS_BUILD_32_LIKE_64)
+typedef long NSInteger;
+typedef unsigned long NSUInteger;
+#define NSIntegerMin LONG_MIN
+#define NSIntegerMax LONG_MAX
+#define NSUIntegerMax ULONG_MAX
+#else // defined(__LP64__) || defined(NS_BUILD_32_LIKE_64)
+typedef int NSInteger;
+typedef unsigned int NSUInteger;
+#define NSIntegerMin INT_MIN
+#define NSIntegerMax INT_MAX
+#define NSUIntegerMax UINT_MAX
+#endif // defined(__LP64__) || defined(NS_BUILD_32_LIKE_64)
+#endif // NSINTEGER_DEFINED
+
+
+#ifndef _JSONKIT_H_
+#define _JSONKIT_H_
+
+#if defined(__GNUC__) && (__GNUC__ >= 4) && defined(__APPLE_CC__) && (__APPLE_CC__ >= 5465)
+#define JK_DEPRECATED_ATTRIBUTE __attribute__((deprecated))
+#else
+#define JK_DEPRECATED_ATTRIBUTE
+#endif
+
+#define JSONKIT_VERSION_MAJOR 1
+#define JSONKIT_VERSION_MINOR 4
+
+typedef NSUInteger JKFlags;
+
+/*
+ JKParseOptionComments : Allow C style // and /_* ... *_/ (without a _, obviously) comments in JSON.
+ JKParseOptionUnicodeNewlines : Allow Unicode recommended (?:\r\n|[\n\v\f\r\x85\p{Zl}\p{Zp}]) newlines.
+ JKParseOptionLooseUnicode : Normally the decoder will stop with an error at any malformed Unicode.
+ This option allows JSON with malformed Unicode to be parsed without reporting an error.
+ Any malformed Unicode is replaced with \uFFFD, or "REPLACEMENT CHARACTER".
+ */
+
+enum {
+ JKParseOptionNone = 0,
+ JKParseOptionStrict = 0,
+ JKParseOptionComments = (1 << 0),
+ JKParseOptionUnicodeNewlines = (1 << 1),
+ JKParseOptionLooseUnicode = (1 << 2),
+ JKParseOptionPermitTextAfterValidJSON = (1 << 3),
+ JKParseOptionValidFlags = (JKParseOptionComments | JKParseOptionUnicodeNewlines | JKParseOptionLooseUnicode | JKParseOptionPermitTextAfterValidJSON),
+};
+typedef JKFlags JKParseOptionFlags;
+
+enum {
+ JKSerializeOptionNone = 0,
+ JKSerializeOptionPretty = (1 << 0),
+ JKSerializeOptionEscapeUnicode = (1 << 1),
+ JKSerializeOptionEscapeForwardSlashes = (1 << 4),
+ JKSerializeOptionValidFlags = (JKSerializeOptionPretty | JKSerializeOptionEscapeUnicode | JKSerializeOptionEscapeForwardSlashes),
+};
+typedef JKFlags JKSerializeOptionFlags;
+
+#ifdef __OBJC__
+
+typedef struct JKParseState JKParseState; // Opaque internal, private type.
+
+// As a general rule of thumb, if you use a method that doesn't accept a JKParseOptionFlags argument, it defaults to JKParseOptionStrict
+
+@interface JSONDecoder : NSObject {
+ JKParseState *parseState;
+}
++ (id)decoder;
++ (id)decoderWithParseOptions:(JKParseOptionFlags)parseOptionFlags;
+- (id)initWithParseOptions:(JKParseOptionFlags)parseOptionFlags;
+- (void)clearCache;
+
+// The parse... methods were deprecated in v1.4 in favor of the v1.4 objectWith... methods.
+- (id)parseUTF8String:(const unsigned char *)string length:(size_t)length JK_DEPRECATED_ATTRIBUTE; // Deprecated in JSONKit v1.4. Use objectWithUTF8String:length: instead.
+- (id)parseUTF8String:(const unsigned char *)string length:(size_t)length error:(NSError **)error JK_DEPRECATED_ATTRIBUTE; // Deprecated in JSONKit v1.4. Use objectWithUTF8String:length:error: instead.
+// The NSData MUST be UTF8 encoded JSON.
+- (id)parseJSONData:(NSData *)jsonData JK_DEPRECATED_ATTRIBUTE; // Deprecated in JSONKit v1.4. Use objectWithData: instead.
+- (id)parseJSONData:(NSData *)jsonData error:(NSError **)error JK_DEPRECATED_ATTRIBUTE; // Deprecated in JSONKit v1.4. Use objectWithData:error: instead.
+
+// Methods that return immutable collection objects.
+- (id)objectWithUTF8String:(const unsigned char *)string length:(NSUInteger)length;
+- (id)objectWithUTF8String:(const unsigned char *)string length:(NSUInteger)length error:(NSError **)error;
+// The NSData MUST be UTF8 encoded JSON.
+- (id)objectWithData:(NSData *)jsonData;
+- (id)objectWithData:(NSData *)jsonData error:(NSError **)error;
+
+// Methods that return mutable collection objects.
+- (id)mutableObjectWithUTF8String:(const unsigned char *)string length:(NSUInteger)length;
+- (id)mutableObjectWithUTF8String:(const unsigned char *)string length:(NSUInteger)length error:(NSError **)error;
+// The NSData MUST be UTF8 encoded JSON.
+- (id)mutableObjectWithData:(NSData *)jsonData;
+- (id)mutableObjectWithData:(NSData *)jsonData error:(NSError **)error;
+
+@end
+
+////////////
+#pragma mark Deserializing methods
+////////////
+
+@interface NSString (JSONKitDeserializing)
+- (id)objectFromJSONString;
+- (id)objectFromJSONStringWithParseOptions:(JKParseOptionFlags)parseOptionFlags;
+- (id)objectFromJSONStringWithParseOptions:(JKParseOptionFlags)parseOptionFlags error:(NSError **)error;
+- (id)mutableObjectFromJSONString;
+- (id)mutableObjectFromJSONStringWithParseOptions:(JKParseOptionFlags)parseOptionFlags;
+- (id)mutableObjectFromJSONStringWithParseOptions:(JKParseOptionFlags)parseOptionFlags error:(NSError **)error;
+@end
+
+@interface NSData (JSONKitDeserializing)
+// The NSData MUST be UTF8 encoded JSON.
+- (id)objectFromJSONData;
+- (id)objectFromJSONDataWithParseOptions:(JKParseOptionFlags)parseOptionFlags;
+- (id)objectFromJSONDataWithParseOptions:(JKParseOptionFlags)parseOptionFlags error:(NSError **)error;
+- (id)mutableObjectFromJSONData;
+- (id)mutableObjectFromJSONDataWithParseOptions:(JKParseOptionFlags)parseOptionFlags;
+- (id)mutableObjectFromJSONDataWithParseOptions:(JKParseOptionFlags)parseOptionFlags error:(NSError **)error;
+@end
+
+////////////
+#pragma mark Serializing methods
+////////////
+
+@interface NSString (JSONKitSerializing)
+// Convenience methods for those that need to serialize the receiving NSString (i.e., instead of having to serialize a NSArray with a single NSString, you can "serialize to JSON" just the NSString).
+// Normally, a string that is serialized to JSON has quotation marks surrounding it, which you may or may not want when serializing a single string, and can be controlled with includeQuotes:
+// includeQuotes:YES `a "test"...` -> `"a \"test\"..."`
+// includeQuotes:NO `a "test"...` -> `a \"test\"...`
+- (NSData *)JSONData; // Invokes JSONDataWithOptions:JKSerializeOptionNone includeQuotes:YES
+- (NSData *)JSONDataWithOptions:(JKSerializeOptionFlags)serializeOptions includeQuotes:(BOOL)includeQuotes error:(NSError **)error;
+- (NSString *)JSONString; // Invokes JSONStringWithOptions:JKSerializeOptionNone includeQuotes:YES
+- (NSString *)JSONStringWithOptions:(JKSerializeOptionFlags)serializeOptions includeQuotes:(BOOL)includeQuotes error:(NSError **)error;
+@end
+
+@interface NSArray (JSONKitSerializing)
+- (NSData *)JSONData;
+- (NSData *)JSONDataWithOptions:(JKSerializeOptionFlags)serializeOptions error:(NSError **)error;
+- (NSData *)JSONDataWithOptions:(JKSerializeOptionFlags)serializeOptions serializeUnsupportedClassesUsingDelegate:(id)delegate selector:(SEL)selector error:(NSError **)error;
+- (NSString *)JSONString;
+- (NSString *)JSONStringWithOptions:(JKSerializeOptionFlags)serializeOptions error:(NSError **)error;
+- (NSString *)JSONStringWithOptions:(JKSerializeOptionFlags)serializeOptions serializeUnsupportedClassesUsingDelegate:(id)delegate selector:(SEL)selector error:(NSError **)error;
+@end
+
+@interface NSDictionary (JSONKitSerializing)
+- (NSData *)JSONData;
+- (NSData *)JSONDataWithOptions:(JKSerializeOptionFlags)serializeOptions error:(NSError **)error;
+- (NSData *)JSONDataWithOptions:(JKSerializeOptionFlags)serializeOptions serializeUnsupportedClassesUsingDelegate:(id)delegate selector:(SEL)selector error:(NSError **)error;
+- (NSString *)JSONString;
+- (NSString *)JSONStringWithOptions:(JKSerializeOptionFlags)serializeOptions error:(NSError **)error;
+- (NSString *)JSONStringWithOptions:(JKSerializeOptionFlags)serializeOptions serializeUnsupportedClassesUsingDelegate:(id)delegate selector:(SEL)selector error:(NSError **)error;
+@end
+
+#ifdef __BLOCKS__
+
+@interface NSArray (JSONKitSerializingBlockAdditions)
+- (NSData *)JSONDataWithOptions:(JKSerializeOptionFlags)serializeOptions serializeUnsupportedClassesUsingBlock:(id(^)(id object))block error:(NSError **)error;
+- (NSString *)JSONStringWithOptions:(JKSerializeOptionFlags)serializeOptions serializeUnsupportedClassesUsingBlock:(id(^)(id object))block error:(NSError **)error;
+@end
+
+@interface NSDictionary (JSONKitSerializingBlockAdditions)
+- (NSData *)JSONDataWithOptions:(JKSerializeOptionFlags)serializeOptions serializeUnsupportedClassesUsingBlock:(id(^)(id object))block error:(NSError **)error;
+- (NSString *)JSONStringWithOptions:(JKSerializeOptionFlags)serializeOptions serializeUnsupportedClassesUsingBlock:(id(^)(id object))block error:(NSError **)error;
+@end
+
+#endif
+
+
+#endif // __OBJC__
+
+#endif // _JSONKIT_H_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
3,059 Example/AEURLExample/JSONKit.m
3,059 additions, 0 deletions not shown because the diff is too large. Please use a local Git client to view these changes.
195 Example/AEURLExample/en.lproj/AEViewController.xib
@@ -0,0 +1,195 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<archive type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="8.00">
+ <data>
+ <int key="IBDocument.SystemTarget">1280</int>
+ <string key="IBDocument.SystemVersion">11C73</string>
+ <string key="IBDocument.InterfaceBuilderVersion">1938</string>
+ <string key="IBDocument.AppKitVersion">1138.23</string>
+ <string key="IBDocument.HIToolboxVersion">567.00</string>
+ <object class="NSMutableDictionary" key="IBDocument.PluginVersions">
+ <string key="NS.key.0">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ <string key="NS.object.0">933</string>
+ </object>
+ <array key="IBDocument.IntegratedClassDependencies">
+ <string>IBProxyObject</string>
+ <string>IBUITableView</string>
+ </array>
+ <array key="IBDocument.PluginDependencies">
+ <string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ </array>
+ <object class="NSMutableDictionary" key="IBDocument.Metadata">
+ <string key="NS.key.0">PluginDependencyRecalculationVersion</string>
+ <integer value="1" key="NS.object.0"/>
+ </object>
+ <array class="NSMutableArray" key="IBDocument.RootObjects" id="1000">
+ <object class="IBProxyObject" id="372490531">
+ <string key="IBProxiedObjectIdentifier">IBFilesOwner</string>
+ <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
+ </object>
+ <object class="IBProxyObject" id="843779117">
+ <string key="IBProxiedObjectIdentifier">IBFirstResponder</string>
+ <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
+ </object>
+ <object class="IBUITableView" id="857071526">
+ <reference key="NSNextResponder"/>
+ <int key="NSvFlags">274</int>
+ <string key="NSFrameSize">{320, 460}</string>
+ <reference key="NSSuperview"/>
+ <reference key="NSWindow"/>
+ <string key="NSReuseIdentifierKey">_NS:418</string>
+ <object class="NSColor" key="IBUIBackgroundColor">
+ <int key="NSColorSpace">10</int>
+ <object class="NSImage" key="NSImage">
+ <int key="NSImageFlags">549453824</int>
+ <string key="NSSize">{512, 1}</string>
+ <array class="NSMutableArray" key="NSReps">
+ <array>
+ <integer value="0"/>
+ <object class="NSBitmapImageRep">
+ <object class="NSData" key="NSTIFFRepresentation">
+ <bytes key="NS.bytes">TU0AKgAACAjFzNT/xczU/8XM1P/FzNT/xczS/8vS2P/L0tj/xczU/8XM1P/FzNT/xczU/8XM0v/L0tj/
+y9LY/8XM1P/FzNT/xczU/8XM1P/FzNL/y9LY/8vS2P/FzNT/xczU/8XM1P/FzNT/xczS/8vS2P/L0tj/
+xczU/8XM1P/FzNT/xczU/8XM0v/L0tj/y9LY/8XM1P/FzNT/xczU/8XM1P/FzNL/y9LY/8vS2P/FzNT/
+xczU/8XM1P/FzNT/xczS/8vS2P/L0tj/xczU/8XM1P/FzNT/xczU/8XM0v/L0tj/y9LY/8XM1P/FzNT/
+xczU/8XM1P/FzNL/y9LY/8vS2P/FzNT/xczU/8XM1P/FzNT/xczS/8vS2P/L0tj/xczU/8XM1P/FzNT/
+xczU/8XM0v/L0tj/y9LY/8XM1P/FzNT/xczU/8XM1P/FzNL/y9LY/8vS2P/FzNT/xczU/8XM1P/FzNT/
+xczS/8vS2P/L0tj/xczU/8XM1P/FzNT/xczU/8XM0v/L0tj/y9LY/8XM1P/FzNT/xczU/8XM1P/FzNL/
+y9LY/8vS2P/FzNT/xczU/8XM1P/FzNT/xczS/8vS2P/L0tj/xczU/8XM1P/FzNT/xczU/8XM0v/L0tj/
+y9LY/8XM1P/FzNT/xczU/8XM1P/FzNL/y9LY/8vS2P/FzNT/xczU/8XM1P/FzNT/xczS/8vS2P/L0tj/
+xczU/8XM1P/FzNT/xczU/8XM0v/L0tj/y9LY/8XM1P/FzNT/xczU/8XM1P/FzNL/y9LY/8vS2P/FzNT/
+xczU/8XM1P/FzNT/xczS/8vS2P/L0tj/xczU/8XM1P/FzNT/xczU/8XM0v/L0tj/y9LY/8XM1P/FzNT/
+xczU/8XM1P/FzNL/y9LY/8vS2P/FzNT/xczU/8XM1P/FzNT/xczS/8vS2P/L0tj/xczU/8XM1P/FzNT/
+xczU/8XM0v/L0tj/y9LY/8XM1P/FzNT/xczU/8XM1P/FzNL/y9LY/8vS2P/FzNT/xczU/8XM1P/FzNT/
+xczS/8vS2P/L0tj/xczU/8XM1P/FzNT/xczU/8XM0v/L0tj/y9LY/8XM1P/FzNT/xczU/8XM1P/FzNL/
+y9LY/8vS2P/FzNT/xczU/8XM1P/FzNT/xczS/8vS2P/L0tj/xczU/8XM1P/FzNT/xczU/8XM0v/L0tj/
+y9LY/8XM1P/FzNT/xczU/8XM1P/FzNL/y9LY/8vS2P/FzNT/xczU/8XM1P/FzNT/xczS/8vS2P/L0tj/
+xczU/8XM1P/FzNT/xczU/8XM0v/L0tj/y9LY/8XM1P/FzNT/xczU/8XM1P/FzNL/y9LY/8vS2P/FzNT/
+xczU/8XM1P/FzNT/xczS/8vS2P/L0tj/xczU/8XM1P/FzNT/xczU/8XM0v/L0tj/y9LY/8XM1P/FzNT/
+xczU/8XM1P/FzNL/y9LY/8vS2P/FzNT/xczU/8XM1P/FzNT/xczS/8vS2P/L0tj/xczU/8XM1P/FzNT/
+xczU/8XM0v/L0tj/y9LY/8XM1P/FzNT/xczU/8XM1P/FzNL/y9LY/8vS2P/FzNT/xczU/8XM1P/FzNT/
+xczS/8vS2P/L0tj/xczU/8XM1P/FzNT/xczU/8XM0v/L0tj/y9LY/8XM1P/FzNT/xczU/8XM1P/FzNL/
+y9LY/8vS2P/FzNT/xczU/8XM1P/FzNT/xczS/8vS2P/L0tj/xczU/8XM1P/FzNT/xczU/8XM0v/L0tj/
+y9LY/8XM1P/FzNT/xczU/8XM1P/FzNL/y9LY/8vS2P/FzNT/xczU/8XM1P/FzNT/xczS/8vS2P/L0tj/
+xczU/8XM1P/FzNT/xczU/8XM0v/L0tj/y9LY/8XM1P/FzNT/xczU/8XM1P/FzNL/y9LY/8vS2P/FzNT/
+xczU/8XM1P/FzNT/xczS/8vS2P/L0tj/xczU/8XM1P/FzNT/xczU/8XM0v/L0tj/y9LY/8XM1P/FzNT/
+xczU/8XM1P/FzNL/y9LY/8vS2P/FzNT/xczU/8XM1P/FzNT/xczS/8vS2P/L0tj/xczU/8XM1P/FzNT/
+xczU/8XM0v/L0tj/y9LY/8XM1P/FzNT/xczU/8XM1P/FzNL/y9LY/8vS2P/FzNT/xczU/8XM1P/FzNT/
+xczS/8vS2P/L0tj/xczU/8XM1P/FzNT/xczU/8XM0v/L0tj/y9LY/8XM1P/FzNT/xczU/8XM1P/FzNL/
+y9LY/8vS2P/FzNT/xczU/8XM1P/FzNT/xczS/8vS2P/L0tj/xczU/8XM1P/FzNT/xczU/8XM0v/L0tj/
+y9LY/8XM1P/FzNT/xczU/8XM1P/FzNL/y9LY/8vS2P/FzNT/xczU/8XM1P/FzNT/xczS/8vS2P/L0tj/
+xczU/8XM1P/FzNT/xczU/8XM0v/L0tj/y9LY/8XM1P/FzNT/xczU/8XM1P/FzNL/y9LY/8vS2P/FzNT/
+xczU/8XM1P/FzNT/xczS/8vS2P/L0tj/xczU/8XM1P/FzNT/xczU/8XM0v/L0tj/y9LY/8XM1P/FzNT/
+xczU/8XM1P/FzNL/y9LY/8vS2P/FzNT/xczU/8XM1P/FzNT/xczS/8vS2P/L0tj/xczU/8XM1P/FzNT/
+xczU/8XM0v/L0tj/y9LY/8XM1P/FzNT/xczU/8XM1P/FzNL/y9LY/8vS2P/FzNT/xczU/8XM1P/FzNT/
+xczS/8vS2P/L0tj/xczU/wANAQAAAwAAAAECAAAAAQEAAwAAAAEAAQAAAQIAAwAAAAQAAAiqAQMAAwAA
+AAEAAQAAAQYAAwAAAAEAAgAAAREABAAAAAEAAAAIARIAAwAAAAEAAQAAARUAAwAAAAEABAAAARYAAwAA
+AAEAAQAAARcABAAAAAEAAAgAARwAAwAAAAEAAQAAAVIAAwAAAAEAAQAAAVMAAwAAAAQAAAiyAAAAAAAI
+AAgACAAIAAEAAQABAAE</bytes>
+ </object>
+ </object>
+ </array>
+ </array>
+ <object class="NSColor" key="NSColor">
+ <int key="NSColorSpace">3</int>
+ <bytes key="NSWhite">MCAwAA</bytes>
+ </object>
+ </object>
+ <string key="IBUIColorCocoaTouchKeyPath">groupTableViewBackgroundColor</string>
+ </object>
+ <bool key="IBUIClipsSubviews">YES</bool>
+ <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
+ <bool key="IBUIAlwaysBounceVertical">YES</bool>
+ <int key="IBUIStyle">1</int>
+ <int key="IBUISeparatorStyle">2</int>
+ <int key="IBUISectionIndexMinimumDisplayRowCount">0</int>
+ <bool key="IBUIShowsSelectionImmediatelyOnTouchBegin">YES</bool>
+ <float key="IBUIRowHeight">44</float>
+ <float key="IBUISectionHeaderHeight">10</float>
+ <float key="IBUISectionFooterHeight">10</float>
+ </object>
+ </array>
+ <object class="IBObjectContainer" key="IBDocument.Objects">
+ <array class="NSMutableArray" key="connectionRecords">
+ <object class="IBConnectionRecord">
+ <object class="IBCocoaTouchOutletConnection" key="connection">
+ <string key="label">view</string>
+ <reference key="source" ref="372490531"/>
+ <reference key="destination" ref="857071526"/>
+ </object>
+ <int key="connectionID">9</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBCocoaTouchOutletConnection" key="connection">
+ <string key="label">dataSource</string>
+ <reference key="source" ref="857071526"/>
+ <reference key="destination" ref="372490531"/>
+ </object>
+ <int key="connectionID">10</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBCocoaTouchOutletConnection" key="connection">
+ <string key="label">delegate</string>
+ <reference key="source" ref="857071526"/>
+ <reference key="destination" ref="372490531"/>
+ </object>
+ <int key="connectionID">11</int>
+ </object>
+ </array>
+ <object class="IBMutableOrderedSet" key="objectRecords">
+ <array key="orderedObjects">
+ <object class="IBObjectRecord">
+ <int key="objectID">0</int>
+ <array key="object" id="0"/>
+ <reference key="children" ref="1000"/>
+ <nil key="parent"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">-1</int>
+ <reference key="object" ref="372490531"/>
+ <reference key="parent" ref="0"/>
+ <string key="objectName">File's Owner</string>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">-2</int>
+ <reference key="object" ref="843779117"/>
+ <reference key="parent" ref="0"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">8</int>
+ <reference key="object" ref="857071526"/>
+ <reference key="parent" ref="0"/>
+ </object>
+ </array>
+ </object>
+ <dictionary class="NSMutableDictionary" key="flattenedProperties">
+ <string key="-1.CustomClassName">AEViewController</string>
+ <string key="-1.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ <string key="-2.CustomClassName">UIResponder</string>
+ <string key="-2.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ <string key="8.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ </dictionary>
+ <dictionary class="NSMutableDictionary" key="unlocalizedProperties"/>
+ <nil key="activeLocalization"/>
+ <dictionary class="NSMutableDictionary" key="localizations"/>
+ <nil key="sourceID"/>
+ <int key="maxID">11</int>
+ </object>
+ <object class="IBClassDescriber" key="IBDocument.Classes">
+ <array class="NSMutableArray" key="referencedPartialClassDescriptions">
+ <object class="IBPartialClassDescription">
+ <string key="className">AEViewController</string>
+ <string key="superclassName">UITableViewController</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBProjectSource</string>
+ <string key="minorKey">./Classes/AEViewController.h</string>
+ </object>
+ </object>
+ </array>
+ </object>
+ <int key="IBDocument.localizationMode">0</int>
+ <string key="IBDocument.TargetRuntimeIdentifier">IBCocoaTouchFramework</string>
+ <bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
+ <int key="IBDocument.defaultPropertyAccessControl">3</int>
+ <string key="IBCocoaTouchPluginVersion">933</string>
+ </data>
+</archive>
2 Example/AEURLExample/en.lproj/InfoPlist.strings
@@ -0,0 +1,2 @@
+/* Localized versions of Info.plist keys */
+
18 Example/AEURLExample/main.m
@@ -0,0 +1,18 @@
+//
+// main.m
+// AEURLExample
+//
+// Created by Adam Ernst on 10/12/11.
+// Copyright (c) 2011 cosmicsoft. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+
+#import "AEAppDelegate.h"
+
+int main(int argc, char *argv[])
+{
+ @autoreleasepool {
+ return UIApplicationMain(argc, argv, nil, NSStringFromClass([AEAppDelegate class]));
+ }
+}
22 Example/AEURLExampleTests/AEURLExampleTests-Info.plist
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>CFBundleDevelopmentRegion</key>
+ <string>en</string>
+ <key>CFBundleExecutable</key>
+ <string>${EXECUTABLE_NAME}</string>
+ <key>CFBundleIdentifier</key>
+ <string>com.adamernst.${PRODUCT_NAME:rfc1034identifier}</string>
+ <key>CFBundleInfoDictionaryVersion</key>
+ <string>6.0</string>
+ <key>CFBundlePackageType</key>
+ <string>BNDL</string>
+ <key>CFBundleShortVersionString</key>
+ <string>1.0</string>
+ <key>CFBundleSignature</key>
+ <string>????</string>
+ <key>CFBundleVersion</key>
+ <string>1</string>
+</dict>
+</plist>
13 Example/AEURLExampleTests/AEURLExampleTests.h
@@ -0,0 +1,13 @@
+//
+// AEURLExampleTests.h
+// AEURLExampleTests
+//
+// Created by Adam Ernst on 10/12/11.
+// Copyright (c) 2011 cosmicsoft. All rights reserved.
+//
+
+#import <SenTestingKit/SenTestingKit.h>
+
+@interface AEURLExampleTests : SenTestCase
+
+@end
32 Example/AEURLExampleTests/AEURLExampleTests.m
@@ -0,0 +1,32 @@
+//
+// AEURLExampleTests.m
+// AEURLExampleTests
+//
+// Created by Adam Ernst on 10/12/11.
+// Copyright (c) 2011 cosmicsoft. All rights reserved.
+//
+
+#import "AEURLExampleTests.h"
+
+@implementation AEURLExampleTests
+
+- (void)setUp
+{
+ [super setUp];
+
+ // Set-up code here.
+}
+
+- (void)tearDown
+{
+ // Tear-down code here.
+
+ [super tearDown];
+}
+
+- (void)testExample
+{
+ STFail(@"Unit tests are not implemented yet in AEURLExampleTests");
+}
+
+@end
2 Example/AEURLExampleTests/en.lproj/InfoPlist.strings
@@ -0,0 +1,2 @@
+/* Localized versions of Info.plist keys */
+

0 comments on commit 046fd64

Please sign in to comment.
Something went wrong with that request. Please try again.