Skip to content
Browse files

Updated all example projects to reflect changes.

  • Loading branch information...
1 parent 560032f commit 7c5ad9581630a39e9ffe7119b6adfcd7271a51f2 @blakewatters blakewatters committed Jan 17, 2012
Showing with 216 additions and 275 deletions.
  1. +2 −2 Code/Network/RKClient.h
  2. +3 −3 Code/Network/RKClient.m
  3. +1 −0 Code/ObjectMapping/RKObjectLoader.m
  4. +4 −3 Code/ObjectMapping/RKObjectManager.h
  5. +19 −7 Code/ObjectMapping/RKObjectManager.m
  6. +1 −0 Code/ObjectMapping/RKObjectMapper.m
  7. +48 −0 Code/ObjectMapping/RKObjectMappingProvider+Contexts.h
  8. +1 −25 Code/ObjectMapping/RKObjectMappingProvider.h
  9. +1 −0 Code/ObjectMapping/RKObjectMappingProvider.m
  10. +1 −1 Code/ObjectMapping/RKObjectPaginator.m
  11. +1 −1 Examples/RKCatalog/App/RKCatalog.h
  12. +1 −1 Examples/RKCatalog/App/RKCatalogAppDelegate.h
  13. +6 −7 Examples/RKCatalog/App/RKCatalogAppDelegate.m
  14. +1 −0 Examples/RKCatalog/Examples/RKAuthenticationExample/RKAuthenticationExample.h
  15. +18 −6 Examples/RKCatalog/Examples/RKAuthenticationExample/RKAuthenticationExample.m
  16. +2 −1 Examples/RKCatalog/Examples/RKBackgroundRequestExample/RKBackgroundRequestExample.m
  17. +1 −1 Examples/RKCatalog/Examples/RKCoreDataExample/RKCoreDataExample.m
  18. +1 −1 Examples/RKCatalog/Examples/RKKeyValueMappingExample/RKKeyValueMappingExample.m
  19. +1 −1 Examples/RKCatalog/Examples/RKRelationshipMappingExample/RKRelationshipMappingExample.m
  20. +4 −7 Examples/RKCatalog/Examples/RKRequestQueueExample/RKRequestQueueExample.h
  21. +26 −17 Examples/RKCatalog/Examples/RKRequestQueueExample/RKRequestQueueExample.m
  22. +40 −153 Examples/RKMacOSX/RKMacOSX.xcodeproj/project.pbxproj
  23. +3 −5 Examples/RKMacOSX/RKMacOSX/RKMacOSXAppDelegate.h
  24. +4 −3 Examples/RKMacOSX/RKMacOSX/RKMacOSXAppDelegate.m
  25. +3 −4 Examples/RKTwitter/Classes/RKTwitterAppDelegate.m
  26. +2 −8 Examples/RKTwitter/Classes/RKTwitterViewController.m
  27. +2 −3 Examples/RKTwitterCoreData/Classes/RKTwitterAppDelegate.m
  28. +1 −5 Examples/RKTwitterCoreData/Classes/RKTwitterViewController.m
  29. +2 −0 Examples/RestKit CLI/RestKit CLI.xcodeproj/project.pbxproj
  30. +6 −0 RestKit.xcodeproj/project.pbxproj
  31. +8 −8 Specs/ObjectMapping/RKObjectLoaderSpec.m
  32. +1 −1 Specs/ObjectMapping/RKObjectManagerSpec.m
  33. +1 −1 Specs/Runner/RKSpecEnvironment.m
  34. BIN Tools/rkkeypath
View
4 Code/Network/RKClient.h
@@ -478,7 +478,7 @@ NSString *RKPathAppendQueryParams(NSString *resourcePath, NSDictionary *queryPar
@see baseURL
@return A configured RKClient instance ready to send requests
*/
-+ (RKClient *)clientWithBaseURL:(RKURL *)baseURL;
++ (RKClient *)clientWithBaseURL:(NSURL *)baseURL;
+ (RKClient *)clientWithBaseURLString:(NSString *)baseURLString;
/**
@@ -499,7 +499,7 @@ NSString *RKPathAppendQueryParams(NSString *resourcePath, NSDictionary *queryPar
@see baseURL
@return A configured RKClient instance ready to send requests
*/
-- (id)initWithBaseURL:(RKURL *)baseURL;
+- (id)initWithBaseURL:(NSURL *)baseURL;
- (id)initWithBaseURLString:(NSString *)baseURLString;
/////////////////////////////////////////////////////////////////////////
View
6 Code/Network/RKClient.m
@@ -102,7 +102,7 @@ + (RKClient *)clientWithBaseURLString:(NSString *)baseURLString {
return [self clientWithBaseURL:[RKURL URLWithString:baseURLString]];
}
-+ (RKClient *)clientWithBaseURL:(RKURL *)baseURL {
++ (RKClient *)clientWithBaseURL:(NSURL *)baseURL {
RKClient *client = [[[self alloc] initWithBaseURL:baseURL] autorelease];
return client;
}
@@ -139,11 +139,11 @@ - (id)init {
return self;
}
-- (id)initWithBaseURL:(RKURL *)baseURL {
+- (id)initWithBaseURL:(NSURL *)baseURL {
self = [self init];
if (self) {
self.cachePolicy = RKRequestCachePolicyDefault;
- self.baseURL = baseURL;
+ self.baseURL = [RKURL URLWithBaseURL:baseURL];
if (sharedClient == nil) {
[RKClient setSharedClient:self];
View
1 Code/ObjectMapping/RKObjectLoader.m
@@ -29,6 +29,7 @@
#import "RKParserRegistry.h"
#import "RKRequest_Internals.h"
#import "RKObjectSerializer.h"
+#import "RKObjectMappingProvider+Contexts.h"
// Set Logging Component
#undef RKLogComponent
View
7 Code/ObjectMapping/RKObjectManager.h
@@ -135,9 +135,8 @@ typedef enum {
Create and initialize a new object manager. If this is the first instance created
it will be set as the shared instance
*/
-// TODO: Both of these should be `managerWith` instead of `objectManagerWith`
-+ (RKObjectManager*)objectManagerWithBaseURLString:(NSString *)baseURLString;
-+ (RKObjectManager*)objectManagerWithBaseURL:(RKURL *)baseURL;
++ (RKObjectManager*)managerWithBaseURLString:(NSString *)baseURLString;
++ (RKObjectManager*)managerWithBaseURL:(NSURL *)baseURL;
/**
Initializes a newly created object manager with a specified baseURL.
@@ -431,6 +430,8 @@ typedef enum {
- (RKObjectPaginator *)paginatorWithResourcePathPattern:(NSString *)resourcePathPattern;
++ (RKObjectManager*)objectManagerWithBaseURLString:(NSString *)baseURLString;
++ (RKObjectManager*)objectManagerWithBaseURL:(NSURL *)baseURL;
- (RKObjectLoader*)objectLoaderWithResourcePath:(NSString*)resourcePath delegate:(id<RKObjectLoaderDelegate>)delegate DEPRECATED_ATTRIBUTE;
- (RKObjectLoader*)objectLoaderForObject:(id<NSObject>)object method:(RKRequestMethod)method delegate:(id<RKObjectLoaderDelegate>)delegate DEPRECATED_ATTRIBUTE;
View
26 Code/ObjectMapping/RKObjectManager.m
@@ -66,6 +66,11 @@ - (id)initWithBaseURL:(RKURL *)baseURL {
selector:@selector(reachabilityChanged:)
name:RKReachabilityDidChangeNotification
object:_client.reachabilityObserver];
+
+ // Set shared manager if nil
+ if (nil == sharedManager) {
+ [RKObjectManager setSharedManager:self];
+ }
}
return self;
@@ -81,15 +86,12 @@ + (void)setSharedManager:(RKObjectManager*)manager {
sharedManager = manager;
}
-+ (RKObjectManager*)objectManagerWithBaseURLString:(NSString *)baseURLString {
- return [self objectManagerWithBaseURL:[RKURL URLWithString:baseURLString]];
++ (RKObjectManager*)managerWithBaseURLString:(NSString *)baseURLString {
+ return [self managerWithBaseURL:[RKURL URLWithString:baseURLString]];
}
-+ (RKObjectManager*)objectManagerWithBaseURL:(RKURL *)baseURL {
- RKObjectManager* manager = [[[self alloc] initWithBaseURL:baseURL] autorelease];
- if (nil == sharedManager) {
- [RKObjectManager setSharedManager:manager];
- }
++ (RKObjectManager*)managerWithBaseURL:(NSURL *)baseURL {
+ RKObjectManager* manager = [[[self alloc] initWithBaseURL:baseURL] autorelease];
return manager;
}
@@ -402,4 +404,14 @@ - (void)configureObjectLoader:(RKObjectLoader *)objectLoader {
[self configureRequest:objectLoader];
}
+#pragma mark - Deprecations
+
++ (RKObjectManager*)objectManagerWithBaseURLString:(NSString *)baseURLString {
+ return [self managerWithBaseURLString:baseURLString];
+}
+
++ (RKObjectManager*)objectManagerWithBaseURL:(NSURL *)baseURL {
+ return [self managerWithBaseURL:baseURL];
+}
+
@end
View
1 Code/ObjectMapping/RKObjectMapper.m
@@ -21,6 +21,7 @@
#import "RKObjectMapper.h"
#import "RKObjectMapperError.h"
#import "RKObjectMapper_Private.h"
+#import "RKObjectMappingProvider+Contexts.h"
// Set Logging Component
#undef RKLogComponent
View
48 Code/ObjectMapping/RKObjectMappingProvider+Contexts.h
@@ -0,0 +1,48 @@
+//
+// RKObjectMappingProvider.m
+// RestKit
+//
+// Created by Blake Watters on 1/17/12.
+// Copyright 2011 RestKit
+//
+// 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.
+//
+
+#import "RKObjectMappingProvider.h"
+
+// Contexts provide primitives for managing collections of object mappings namespaced
+// within a single mapping provider. This enables easy reuse and extension via categories.
+@interface RKObjectMappingProvider (Contexts)
+
+- (void)initializeContext:(RKObjectMappingProviderContext)context withValue:(id)value;
+- (id)valueForContext:(RKObjectMappingProviderContext)context;
+- (void)setValue:(id)value forContext:(RKObjectMappingProviderContext)context;
+
+- (id<RKObjectMappingDefinition>)mappingForContext:(RKObjectMappingProviderContext)context;
+/**
+ Stores a single object mapping for a given context. Useful when a component needs to enable
+ configuration via one (and only one) object mapping.
+ */
+- (void)setMapping:(id<RKObjectMappingDefinition>)mapping context:(RKObjectMappingProviderContext)context;
+- (NSArray *)mappingsForContext:(RKObjectMappingProviderContext)context;
+- (void)addMapping:(id<RKObjectMappingDefinition>)mapping context:(RKObjectMappingProviderContext)context;
+- (void)removeMapping:(id<RKObjectMappingDefinition>)mapping context:(RKObjectMappingProviderContext)context;
+- (id<RKObjectMappingDefinition>)mappingForKeyPath:(NSString *)keyPath context:(RKObjectMappingProviderContext)context;
+- (void)setMapping:(id<RKObjectMappingDefinition>)mapping forKeyPath:(NSString *)keyPath context:(RKObjectMappingProviderContext)context;
+- (void)removeMappingForKeyPath:(NSString *)keyPath context:(RKObjectMappingProviderContext)context;
+
+- (void)setMapping:(id<RKObjectMappingDefinition>)mapping forPattern:(NSString *)pattern atIndex:(NSUInteger)index context:(RKObjectMappingProviderContext)context;
+- (void)setMapping:(id<RKObjectMappingDefinition>)mapping forPattern:(NSString *)pattern context:(RKObjectMappingProviderContext)context;
+- (id<RKObjectMappingDefinition>)mappingForPatternMatchingString:(NSString *)string context:(RKObjectMappingProviderContext)context;
+
+@end
View
26 Code/ObjectMapping/RKObjectMappingProvider.h
@@ -22,6 +22,7 @@
#import "RKDynamicObjectMapping.h"
// Internal framework contexts
+// see RKObjectMappingProvider+Contexts
typedef enum {
RKObjectMappingProviderContextObjectsByKeyPath = 1000,
RKObjectMappingProviderContextObjectsByType,
@@ -266,31 +267,6 @@ typedef enum {
@end
-@interface RKObjectMappingProvider (Contexts)
-
-- (void)initializeContext:(RKObjectMappingProviderContext)context withValue:(id)value;
-- (id)valueForContext:(RKObjectMappingProviderContext)context;
-- (void)setValue:(id)value forContext:(RKObjectMappingProviderContext)context;
-
-- (id<RKObjectMappingDefinition>)mappingForContext:(RKObjectMappingProviderContext)context;
-/**
- Stores a single object mapping for a given context. Useful when a component needs to enable
- configuration via one (and only one) object mapping.
- */
-- (void)setMapping:(id<RKObjectMappingDefinition>)mapping context:(RKObjectMappingProviderContext)context;
-- (NSArray *)mappingsForContext:(RKObjectMappingProviderContext)context;
-- (void)addMapping:(id<RKObjectMappingDefinition>)mapping context:(RKObjectMappingProviderContext)context;
-- (void)removeMapping:(id<RKObjectMappingDefinition>)mapping context:(RKObjectMappingProviderContext)context;
-- (id<RKObjectMappingDefinition>)mappingForKeyPath:(NSString *)keyPath context:(RKObjectMappingProviderContext)context;
-- (void)setMapping:(id<RKObjectMappingDefinition>)mapping forKeyPath:(NSString *)keyPath context:(RKObjectMappingProviderContext)context;
-- (void)removeMappingForKeyPath:(NSString *)keyPath context:(RKObjectMappingProviderContext)context;
-
-- (void)setMapping:(id<RKObjectMappingDefinition>)mapping forPattern:(NSString *)pattern atIndex:(NSUInteger)index context:(RKObjectMappingProviderContext)context;
-- (void)setMapping:(id<RKObjectMappingDefinition>)mapping forPattern:(NSString *)pattern context:(RKObjectMappingProviderContext)context;
-- (id<RKObjectMappingDefinition>)mappingForPatternMatchingString:(NSString *)string context:(RKObjectMappingProviderContext)context;
-
-@end
-
// Method signatures being phased out
@interface RKObjectMappingProvider (CompatibilityAliases)
+ (RKObjectMappingProvider *)objectMappingProvider;
View
1 Code/ObjectMapping/RKObjectMappingProvider.m
@@ -19,6 +19,7 @@
//
#import "RKObjectMappingProvider.h"
+#import "RKObjectMappingProvider+Contexts.h"
#import "RKOrderedDictionary.h"
#import "RKPathMatcher.h"
View
2 Code/ObjectMapping/RKObjectPaginator.m
@@ -163,7 +163,7 @@ - (void)objectLoader:(RKObjectLoader *)loader willMapData:(inout id *)mappableDa
} else if (self.perPage && [self hasObjectCount]) {
float objectCountFloat = self.objectCount;
pageCount = ceilf(objectCountFloat / self.perPage);
- RKLogInfo(@"Paginator objectCount: %d pageCount: %d", self.objectCount, self.pageCount);
+ RKLogInfo(@"Paginator objectCount: %ld pageCount: %ld", (long) self.objectCount, (long) self.pageCount);
} else {
NSAssert(NO, @"Paginator perPage set is 0.");
RKLogError(@"Paginator perPage set is 0.");
View
2 Examples/RKCatalog/App/RKCatalog.h
@@ -11,4 +11,4 @@
#import <RestKit/CoreData.h>
// Import the base URL defined in the app delegate
-extern NSString* gRKCatalogBaseURL;
+extern NSURL* gRKCatalogBaseURL;
View
2 Examples/RKCatalog/App/RKCatalogAppDelegate.h
@@ -3,7 +3,7 @@
// RKCatalog
//
// Created by Blake Watters on 4/21/11.
-// Copyright 2011 Two Toasters. All rights reserved.
+// Copyright 2011 RestKit. All rights reserved.
//
#import <UIKit/UIKit.h>
View
13 Examples/RKCatalog/App/RKCatalogAppDelegate.m
@@ -9,12 +9,12 @@
#import "RKCatalogAppDelegate.h"
#import "RootViewController.h"
-NSString* gRKCatalogBaseURL = nil;
+NSURL *gRKCatalogBaseURL = nil;
@implementation RKCatalogAppDelegate
-@synthesize window=_window;
-@synthesize navigationController=_navigationController;
+@synthesize window;
+@synthesize navigationController;
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
@@ -23,15 +23,14 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
[self.window makeKeyAndVisible];
- // gRKCatalogBaseURL = [@"http://localhost:4567" retain];
- gRKCatalogBaseURL = [@"http://rkcatalog.heroku.com" retain];
+ gRKCatalogBaseURL = [[NSURL alloc] initWithString:@"http://rkcatalog.heroku.com"];
return YES;
}
- (void)dealloc {
- [_window release];
- [_navigationController release];
+ [window release];
+ [navigationController release];
[super dealloc];
}
View
1 Examples/RKCatalog/Examples/RKAuthenticationExample/RKAuthenticationExample.h
@@ -11,6 +11,7 @@
@interface RKAuthenticationExample : UIViewController <RKRequestDelegate, UIPickerViewDelegate, UIPickerViewDataSource>
+@property (nonatomic, retain) RKRequest *authenticatedRequest;
@property (nonatomic, retain) IBOutlet UITextField *URLTextField;
@property (nonatomic, retain) IBOutlet UITextField *usernameTextField;
@property (nonatomic, retain) IBOutlet UITextField *passwordTextField;
View
24 Examples/RKCatalog/Examples/RKAuthenticationExample/RKAuthenticationExample.m
@@ -10,6 +10,7 @@
@implementation RKAuthenticationExample
+@synthesize authenticatedRequest;
@synthesize URLTextField;
@synthesize usernameTextField;
@synthesize passwordTextField;
@@ -25,27 +26,38 @@ - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
return self;
}
+- (void)dealloc {
+ [authenticatedRequest cancel];
+ [authenticatedRequest release];
+ authenticatedRequest = nil;
+
+ [super dealloc];
+}
+
/**
We are constructing our own RKRequest here rather than working with the client.
It is important to remember that RKClient is really just a factory object for instances
of RKRequest. At any time you can directly configure an RKRequest instead.
*/
- (void)sendRequest {
NSURL *URL = [NSURL URLWithString:[URLTextField text]];
- RKRequest *request = [RKRequest requestWithURL:URL delegate:self];
- request.queue = [RKClient sharedClient].requestQueue;
- request.authenticationType = RKRequestAuthenticationTypeHTTP;
- request.username = [usernameTextField text];
- request.password = [passwordTextField text];
- [request send];
+ RKRequest *newRequest = [RKRequest requestWithURL:URL];
+ newRequest.delegate = self;
+ newRequest.authenticationType = RKRequestAuthenticationTypeHTTP;
+ newRequest.username = [usernameTextField text];
+ newRequest.password = [passwordTextField text];
+
+ self.authenticatedRequest = newRequest;
}
- (void)request:(RKRequest *)request didFailLoadWithError:(NSError *)error {
RKLogError(@"Load of RKRequest %@ failed with error: %@", request, error);
+ [request release];
}
- (void)request:(RKRequest *)request didLoadResponse:(RKResponse *)response {
RKLogCritical(@"Loading of RKRequest %@ completed with status code %d. Response body: %@", request, response.statusCode, [response bodyAsString]);
+ [request release];
}
#pragma mark - UIPickerViewDataSource
View
3 Examples/RKCatalog/Examples/RKBackgroundRequestExample/RKBackgroundRequestExample.m
@@ -32,7 +32,8 @@ - (void)dealloc {
}
- (IBAction)sendRequest {
- RKRequest* request = [[RKClient sharedClient] requestWithResourcePath:@"/RKBackgroundRequestExample" delegate:self];
+ RKRequest* request = [[RKClient sharedClient] requestWithResourcePath:@"/RKBackgroundRequestExample"];
+ request.delegate = self;
request.backgroundPolicy = _segmentedControl.selectedSegmentIndex;
[request send];
_sendButton.enabled = NO;
View
2 Examples/RKCatalog/Examples/RKCoreDataExample/RKCoreDataExample.m
@@ -34,7 +34,7 @@ @implementation RKCoreDataExample
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
- RKObjectManager* manager = [RKObjectManager objectManagerWithBaseURL:@"http://restkit.org"];
+ RKObjectManager* manager = [RKObjectManager managerWithBaseURLString:@"http://restkit.org"];
manager.objectStore = [RKManagedObjectStore objectStoreWithStoreFilename:@"RKCoreDataExample.sqlite"];
[RKObjectManager setSharedManager:manager];
View
2 Examples/RKCatalog/Examples/RKKeyValueMappingExample/RKKeyValueMappingExample.m
@@ -51,7 +51,7 @@ @implementation RKKeyValueMappingExample
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
- [RKObjectManager objectManagerWithBaseURL:gRKCatalogBaseURL];
+ [RKObjectManager managerWithBaseURL:gRKCatalogBaseURL];
}
return self;
View
2 Examples/RKCatalog/Examples/RKRelationshipMappingExample/RKRelationshipMappingExample.m
@@ -18,7 +18,7 @@ @implementation RKRelationshipMappingExample
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
- RKObjectManager* objectManager = [RKObjectManager objectManagerWithBaseURL:gRKCatalogBaseURL];
+ RKObjectManager* objectManager = [RKObjectManager managerWithBaseURL:gRKCatalogBaseURL];
objectManager.objectStore = [RKManagedObjectStore objectStoreWithStoreFilename:@"RKRelationshipMappingExample.sqlite"];
RKManagedObjectMapping* taskMapping = [RKManagedObjectMapping mappingForClass:[Task class]];
View
11 Examples/RKCatalog/Examples/RKRequestQueueExample/RKRequestQueueExample.h
@@ -3,18 +3,15 @@
// RKCatalog
//
// Created by Blake Watters on 4/21/11.
-// Copyright 2011 Two Toasters. All rights reserved.
+// Copyright 2011 RestKit. All rights reserved.
//
#import "RKCatalog.h"
-@interface RKRequestQueueExample : UIViewController <RKRequestQueueDelegate, RKRequestDelegate> {
- UILabel* _statusLabel;
- RKRequestQueue* _queue;
-}
+@interface RKRequestQueueExample : UIViewController <RKRequestQueueDelegate, RKRequestDelegate>
-@property (nonatomic, retain) RKRequestQueue* queue;
-@property (nonatomic, retain) IBOutlet UILabel* statusLabel;
+@property (nonatomic, retain) RKRequestQueue *requestQueue;
+@property (nonatomic, retain) IBOutlet UILabel *statusLabel;
- (IBAction)sendRequest;
- (IBAction)queueRequests;
View
43 Examples/RKCatalog/Examples/RKRequestQueueExample/RKRequestQueueExample.m
@@ -3,16 +3,16 @@
// RKCatalog
//
// Created by Blake Watters on 4/21/11.
-// Copyright 2011 Two Toasters. All rights reserved.
+// Copyright 2011 RestKit. All rights reserved.
//
#import <RestKit/RestKit.h>
#import "RKRequestQueueExample.h"
@implementation RKRequestQueueExample
-@synthesize queue = _queue;
-@synthesize statusLabel = _statusLabel;
+@synthesize requestQueue;
+@synthesize statusLabel;
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
@@ -31,8 +31,9 @@ - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
// We have been dismissed -- clean up any open requests
- (void)dealloc {
[[RKClient sharedClient].requestQueue cancelRequestsWithDelegate:self];
- [_queue cancelAllRequests];
- [_queue release];
+ [requestQueue cancelAllRequests];
+ [requestQueue release];
+ requestQueue = nil;
[super dealloc];
}
@@ -51,36 +52,44 @@ - (IBAction)sendRequest {
}
- (IBAction)queueRequests {
- RKRequestQueue* queue = [RKRequestQueue new];
+ RKRequestQueue *queue = [RKRequestQueue requestQueue];
queue.delegate = self;
queue.concurrentRequestsLimit = 1;
queue.showsNetworkActivityIndicatorWhenBusy = YES;
// Queue up 4 requests
- [queue addRequest:[[RKClient sharedClient] requestWithResourcePath:@"/RKRequestQueueExample" delegate:self]];
- [queue addRequest:[[RKClient sharedClient] requestWithResourcePath:@"/RKRequestQueueExample" delegate:self]];
- [queue addRequest:[[RKClient sharedClient] requestWithResourcePath:@"/RKRequestQueueExample" delegate:self]];
- [queue addRequest:[[RKClient sharedClient] requestWithResourcePath:@"/RKRequestQueueExample" delegate:self]];
+ RKRequest *request = [[RKClient sharedClient] requestWithResourcePath:@"/RKRequestQueueExample"];
+ request.delegate = self;
+ [queue addRequest:request];
+
+ request = [[RKClient sharedClient] requestWithResourcePath:@"/RKRequestQueueExample"];
+ request.delegate = self;
+ [queue addRequest:request];
+
+ request = [[RKClient sharedClient] requestWithResourcePath:@"/RKRequestQueueExample"];
+ request.delegate = self;
+ [queue addRequest:request];
+
+ request = [[RKClient sharedClient] requestWithResourcePath:@"/RKRequestQueueExample"];
+ request.delegate = self;
+ [queue addRequest:request];
// Start processing!
[queue start];
-
- // Manage memory for our ad-hoc queue
- self.queue = queue;
- [queue release];
+ self.requestQueue = queue;
}
- (void)requestQueue:(RKRequestQueue *)queue didSendRequest:(RKRequest *)request {
- _statusLabel.text = [NSString stringWithFormat:@"RKRequestQueue %@ is current loading %d of %d requests",
+ statusLabel.text = [NSString stringWithFormat:@"RKRequestQueue %@ is current loading %d of %d requests",
queue, [queue loadingCount], [queue count]];
}
- (void)requestQueueDidBeginLoading:(RKRequestQueue *)queue {
- _statusLabel.text = [NSString stringWithFormat:@"Queue %@ Began Loading...", queue];
+ statusLabel.text = [NSString stringWithFormat:@"Queue %@ Began Loading...", queue];
}
- (void)requestQueueDidFinishLoading:(RKRequestQueue *)queue {
- _statusLabel.text = [NSString stringWithFormat:@"Queue %@ Finished Loading...", queue];
+ statusLabel.text = [NSString stringWithFormat:@"Queue %@ Finished Loading...", queue];
}
@end
View
193 Examples/RKMacOSX/RKMacOSX.xcodeproj/project.pbxproj
@@ -7,106 +7,53 @@
objects = {
/* Begin PBXBuildFile section */
+ 250DF24F14C67F560001DEFA /* RestKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 250DF24B14C67E9A0001DEFA /* RestKit.framework */; };
25D63919135184CE000879B1 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 25D63918135184CE000879B1 /* Cocoa.framework */; };
25D63923135184CE000879B1 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 25D63921135184CE000879B1 /* InfoPlist.strings */; };
25D63926135184CE000879B1 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 25D63925135184CE000879B1 /* main.m */; };
25D63929135184CE000879B1 /* Credits.rtf in Resources */ = {isa = PBXBuildFile; fileRef = 25D63927135184CE000879B1 /* Credits.rtf */; };
25D6392C135184CE000879B1 /* RKMacOSXAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 25D6392B135184CE000879B1 /* RKMacOSXAppDelegate.m */; };
25D6392F135184CF000879B1 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 25D6392D135184CF000879B1 /* MainMenu.xib */; };
- 25D6397813518514000879B1 /* libRestKitCoreData.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 25D6397213518514000879B1 /* libRestKitCoreData.a */; };
- 25D6397913518514000879B1 /* libRestKitJSONParserJSONKit.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 25D6397313518514000879B1 /* libRestKitJSONParserJSONKit.a */; };
- 25D6397A13518514000879B1 /* libRestKitNetwork.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 25D6397413518514000879B1 /* libRestKitNetwork.a */; };
- 25D6397B13518514000879B1 /* libRestKitObjectMapping.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 25D6397513518514000879B1 /* libRestKitObjectMapping.a */; };
- 25D6397C13518514000879B1 /* libRestKitSupport.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 25D6397613518514000879B1 /* libRestKitSupport.a */; };
25D6397F13518574000879B1 /* CoreData.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 25D6397E13518574000879B1 /* CoreData.framework */; };
25D639811351858A000879B1 /* AppKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 25D639801351858A000879B1 /* AppKit.framework */; };
25D63983135185B6000879B1 /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 25D63982135185B6000879B1 /* SystemConfiguration.framework */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
- 25D63957135184F1000879B1 /* PBXContainerItemProxy */ = {
+ 250DF24614C67E9A0001DEFA /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 25D63938135184F0000879B1 /* RestKit.xcodeproj */;
proxyType = 2;
- remoteGlobalIDString = 253A07FC1255161B00976E89;
- remoteInfo = RestKitNetwork;
- };
- 25D63959135184F1000879B1 /* PBXContainerItemProxy */ = {
- isa = PBXContainerItemProxy;
- containerPortal = 25D63938135184F0000879B1 /* RestKit.xcodeproj */;
- proxyType = 2;
- remoteGlobalIDString = 253A08031255162C00976E89;
- remoteInfo = RestKitObjectMapping;
- };
- 25D6395B135184F1000879B1 /* PBXContainerItemProxy */ = {
- isa = PBXContainerItemProxy;
- containerPortal = 25D63938135184F0000879B1 /* RestKit.xcodeproj */;
- proxyType = 2;
- remoteGlobalIDString = 253A080C12551D3000976E89;
- remoteInfo = RestKitSupport;
- };
- 25D6395D135184F1000879B1 /* PBXContainerItemProxy */ = {
- isa = PBXContainerItemProxy;
- containerPortal = 25D63938135184F0000879B1 /* RestKit.xcodeproj */;
- proxyType = 2;
- remoteGlobalIDString = 2590E64F125231F600531FA8;
- remoteInfo = "RestKitJSONParser+YAJL";
- };
- 25D6395F135184F1000879B1 /* PBXContainerItemProxy */ = {
- isa = PBXContainerItemProxy;
- containerPortal = 25D63938135184F0000879B1 /* RestKit.xcodeproj */;
- proxyType = 2;
- remoteGlobalIDString = 2590E66B1252353700531FA8;
- remoteInfo = "RestKitJSONParser+SBJSON";
- };
- 25D63961135184F1000879B1 /* PBXContainerItemProxy */ = {
- isa = PBXContainerItemProxy;
- containerPortal = 25D63938135184F0000879B1 /* RestKit.xcodeproj */;
- proxyType = 2;
- remoteGlobalIDString = 73057FD11331AD2E001908EE;
- remoteInfo = "RestKitJSONParser+JSONKit";
- };
- 25D63963135184F1000879B1 /* PBXContainerItemProxy */ = {
- isa = PBXContainerItemProxy;
- containerPortal = 25D63938135184F0000879B1 /* RestKit.xcodeproj */;
- proxyType = 2;
- remoteGlobalIDString = 25BD43BD1340315800DBACDD;
- remoteInfo = "RestKitXMLParser+Libxml";
+ remoteGlobalIDString = 25160D1614564E810060A5C5;
+ remoteInfo = RestKit;
};
- 25D63965135184F1000879B1 /* PBXContainerItemProxy */ = {
+ 250DF24814C67E9A0001DEFA /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 25D63938135184F0000879B1 /* RestKit.xcodeproj */;
proxyType = 2;
- remoteGlobalIDString = 253A081412551D5300976E89;
- remoteInfo = RestKitCoreData;
+ remoteGlobalIDString = 25160D2614564E820060A5C5;
+ remoteInfo = RestKitTests;
};
- 25D63967135184F1000879B1 /* PBXContainerItemProxy */ = {
+ 250DF24A14C67E9A0001DEFA /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 25D63938135184F0000879B1 /* RestKit.xcodeproj */;
proxyType = 2;
- remoteGlobalIDString = 2523360511E79F090048F9B4;
- remoteInfo = RestKitThree20;
+ remoteGlobalIDString = 25160E62145651060060A5C5;
+ remoteInfo = RestKitFramework;
};
- 25D63969135184F1000879B1 /* PBXContainerItemProxy */ = {
+ 250DF24C14C67E9A0001DEFA /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 25D63938135184F0000879B1 /* RestKit.xcodeproj */;
proxyType = 2;
- remoteGlobalIDString = 3F6C39A510FE5C95008F47C5;
- remoteInfo = UISpec;
+ remoteGlobalIDString = 25160E78145651060060A5C5;
+ remoteInfo = RestKitFrameworkTests;
};
- 25D6397013518504000879B1 /* PBXContainerItemProxy */ = {
+ 250DF25014C67F630001DEFA /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 25D63938135184F0000879B1 /* RestKit.xcodeproj */;
proxyType = 1;
- remoteGlobalIDString = 255B7588133BABBF00ED76AD;
- remoteInfo = RestKit;
- };
- 25FB6D9F13E4848200F48969 /* PBXContainerItemProxy */ = {
- isa = PBXContainerItemProxy;
- containerPortal = 25D63938135184F0000879B1 /* RestKit.xcodeproj */;
- proxyType = 2;
- remoteGlobalIDString = 20808DBD13DE8CDC000A156A;
- remoteInfo = "RestKitJSONParser+NXJSON";
+ remoteGlobalIDString = 25160E61145651060060A5C5;
+ remoteInfo = RestKitFramework;
};
/* End PBXContainerItemProxy section */
@@ -141,14 +88,10 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
+ 250DF24F14C67F560001DEFA /* RestKit.framework in Frameworks */,
25D63983135185B6000879B1 /* SystemConfiguration.framework in Frameworks */,
25D639811351858A000879B1 /* AppKit.framework in Frameworks */,
25D6397F13518574000879B1 /* CoreData.framework in Frameworks */,
- 25D6397813518514000879B1 /* libRestKitCoreData.a in Frameworks */,
- 25D6397913518514000879B1 /* libRestKitJSONParserJSONKit.a in Frameworks */,
- 25D6397A13518514000879B1 /* libRestKitNetwork.a in Frameworks */,
- 25D6397B13518514000879B1 /* libRestKitObjectMapping.a in Frameworks */,
- 25D6397C13518514000879B1 /* libRestKitSupport.a in Frameworks */,
25D63919135184CE000879B1 /* Cocoa.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
@@ -222,17 +165,10 @@
25D63939135184F0000879B1 /* Products */ = {
isa = PBXGroup;
children = (
- 25D63958135184F1000879B1 /* libRestKitNetwork.a */,
- 25D6395A135184F1000879B1 /* libRestKitObjectMapping.a */,
- 25D6395C135184F1000879B1 /* libRestKitSupport.a */,
- 25FB6DA013E4848200F48969 /* libRestKitJSONParserNXJSON.a */,
- 25D6395E135184F1000879B1 /* libRestKitJSONParserYAJL.a */,
- 25D63960135184F1000879B1 /* libRestKitJSONParserSBJSON.a */,
- 25D63962135184F1000879B1 /* libRestKitJSONParserJSONKit.a */,
- 25D63964135184F1000879B1 /* libRestKitXMLParserLibxml.a */,
- 25D63966135184F1000879B1 /* libRestKitCoreData.a */,
- 25D63968135184F1000879B1 /* libRestKitThree20.a */,
- 25D6396A135184F1000879B1 /* RestKitSpecs.app */,
+ 250DF24714C67E9A0001DEFA /* libRestKit.a */,
+ 250DF24914C67E9A0001DEFA /* RestKitTests.octest */,
+ 250DF24B14C67E9A0001DEFA /* RestKit.framework */,
+ 250DF24D14C67E9A0001DEFA /* RestKitFrameworkTests.octest */,
);
name = Products;
sourceTree = "<group>";
@@ -265,7 +201,7 @@
buildRules = (
);
dependencies = (
- 25D6397113518504000879B1 /* PBXTargetDependency */,
+ 250DF25114C67F630001DEFA /* PBXTargetDependency */,
);
name = RKMacOSX;
productName = RKMacOSX;
@@ -304,81 +240,32 @@
/* End PBXProject section */
/* Begin PBXReferenceProxy section */
- 25D63958135184F1000879B1 /* libRestKitNetwork.a */ = {
+ 250DF24714C67E9A0001DEFA /* libRestKit.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
- path = libRestKitNetwork.a;
- remoteRef = 25D63957135184F1000879B1 /* PBXContainerItemProxy */;
+ path = libRestKit.a;
+ remoteRef = 250DF24614C67E9A0001DEFA /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
- 25D6395A135184F1000879B1 /* libRestKitObjectMapping.a */ = {
+ 250DF24914C67E9A0001DEFA /* RestKitTests.octest */ = {
isa = PBXReferenceProxy;
- fileType = archive.ar;
- path = libRestKitObjectMapping.a;
- remoteRef = 25D63959135184F1000879B1 /* PBXContainerItemProxy */;
+ fileType = wrapper.cfbundle;
+ path = RestKitTests.octest;
+ remoteRef = 250DF24814C67E9A0001DEFA /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
- 25D6395C135184F1000879B1 /* libRestKitSupport.a */ = {
+ 250DF24B14C67E9A0001DEFA /* RestKit.framework */ = {
isa = PBXReferenceProxy;
- fileType = archive.ar;
- path = libRestKitSupport.a;
- remoteRef = 25D6395B135184F1000879B1 /* PBXContainerItemProxy */;
- sourceTree = BUILT_PRODUCTS_DIR;
- };
- 25D6395E135184F1000879B1 /* libRestKitJSONParserYAJL.a */ = {
- isa = PBXReferenceProxy;
- fileType = archive.ar;
- path = libRestKitJSONParserYAJL.a;
- remoteRef = 25D6395D135184F1000879B1 /* PBXContainerItemProxy */;
- sourceTree = BUILT_PRODUCTS_DIR;
- };
- 25D63960135184F1000879B1 /* libRestKitJSONParserSBJSON.a */ = {
- isa = PBXReferenceProxy;
- fileType = archive.ar;
- path = libRestKitJSONParserSBJSON.a;
- remoteRef = 25D6395F135184F1000879B1 /* PBXContainerItemProxy */;
- sourceTree = BUILT_PRODUCTS_DIR;
- };
- 25D63962135184F1000879B1 /* libRestKitJSONParserJSONKit.a */ = {
- isa = PBXReferenceProxy;
- fileType = archive.ar;
- path = libRestKitJSONParserJSONKit.a;
- remoteRef = 25D63961135184F1000879B1 /* PBXContainerItemProxy */;
- sourceTree = BUILT_PRODUCTS_DIR;
- };
- 25D63964135184F1000879B1 /* libRestKitXMLParserLibxml.a */ = {
- isa = PBXReferenceProxy;
- fileType = archive.ar;
- path = libRestKitXMLParserLibxml.a;
- remoteRef = 25D63963135184F1000879B1 /* PBXContainerItemProxy */;
- sourceTree = BUILT_PRODUCTS_DIR;
- };
- 25D63966135184F1000879B1 /* libRestKitCoreData.a */ = {
- isa = PBXReferenceProxy;
- fileType = archive.ar;
- path = libRestKitCoreData.a;
- remoteRef = 25D63965135184F1000879B1 /* PBXContainerItemProxy */;
+ fileType = wrapper.framework;
+ path = RestKit.framework;
+ remoteRef = 250DF24A14C67E9A0001DEFA /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
- 25D63968135184F1000879B1 /* libRestKitThree20.a */ = {
+ 250DF24D14C67E9A0001DEFA /* RestKitFrameworkTests.octest */ = {
isa = PBXReferenceProxy;
- fileType = archive.ar;
- path = libRestKitThree20.a;
- remoteRef = 25D63967135184F1000879B1 /* PBXContainerItemProxy */;
- sourceTree = BUILT_PRODUCTS_DIR;
- };
- 25D6396A135184F1000879B1 /* RestKitSpecs.app */ = {
- isa = PBXReferenceProxy;
- fileType = wrapper.application;
- path = RestKitSpecs.app;
- remoteRef = 25D63969135184F1000879B1 /* PBXContainerItemProxy */;
- sourceTree = BUILT_PRODUCTS_DIR;
- };
- 25FB6DA013E4848200F48969 /* libRestKitJSONParserNXJSON.a */ = {
- isa = PBXReferenceProxy;
- fileType = archive.ar;
- path = libRestKitJSONParserNXJSON.a;
- remoteRef = 25FB6D9F13E4848200F48969 /* PBXContainerItemProxy */;
+ fileType = wrapper.cfbundle;
+ path = RestKitFrameworkTests.octest;
+ remoteRef = 250DF24C14C67E9A0001DEFA /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
/* End PBXReferenceProxy section */
@@ -409,10 +296,10 @@
/* End PBXSourcesBuildPhase section */
/* Begin PBXTargetDependency section */
- 25D6397113518504000879B1 /* PBXTargetDependency */ = {
+ 250DF25114C67F630001DEFA /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
- name = RestKit;
- targetProxy = 25D6397013518504000879B1 /* PBXContainerItemProxy */;
+ name = RestKitFramework;
+ targetProxy = 250DF25014C67F630001DEFA /* PBXContainerItemProxy */;
};
/* End PBXTargetDependency section */
View
8 Examples/RKMacOSX/RKMacOSX/RKMacOSXAppDelegate.h
@@ -3,17 +3,15 @@
// RKMacOSX
//
// Created by Blake Watters on 4/10/11.
-// Copyright 2011 __MyCompanyName__. All rights reserved.
+// Copyright 2011 RestKit. All rights reserved.
//
#import <Cocoa/Cocoa.h>
#import <RestKit/RestKit.h>
-@interface RKMacOSXAppDelegate : NSObject <NSApplicationDelegate, RKRequestDelegate> {
-@private
- NSWindow *window;
-}
+@interface RKMacOSXAppDelegate : NSObject <NSApplicationDelegate, RKRequestDelegate>
+@property (nonatomic, retain) RKClient *client;
@property (assign) IBOutlet NSWindow *window;
@end
View
7 Examples/RKMacOSX/RKMacOSX/RKMacOSXAppDelegate.m
@@ -3,20 +3,21 @@
// RKMacOSX
//
// Created by Blake Watters on 4/10/11.
-// Copyright 2011 __MyCompanyName__. All rights reserved.
+// Copyright 2011 RestKit. All rights reserved.
//
#import "RKMacOSXAppDelegate.h"
@implementation RKMacOSXAppDelegate
+@synthesize client;
@synthesize window;
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
{
// Initialize RestKit
- RKClient* client = [RKClient clientWithBaseURL:@"http://twitter.com"];
- [client get:@"/status/user_timeline/twotoasters.json" delegate:self];
+ self.client = [RKClient clientWithBaseURL:[RKURL URLWithBaseURLString:@"http://twitter.com"]];
+ [self.client get:@"/status/user_timeline/RestKit.json" delegate:self];
}
- (void)request:(RKRequest*)request didLoadResponse:(RKResponse *)response {
View
7 Examples/RKTwitter/Classes/RKTwitterAppDelegate.m
@@ -20,7 +20,7 @@ @implementation RKTwitterAppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
RKLogConfigureByName("RestKit/Network*", RKLogLevelTrace);
// Initialize RestKit
- RKObjectManager* objectManager = [RKObjectManager objectManagerWithBaseURL:@"http://twitter.com"];
+ RKObjectManager* objectManager = [RKObjectManager managerWithBaseURLString:@"http://twitter.com"];
// Enable automatic network activity indicator management
objectManager.client.requestQueue.showsNetworkActivityIndicatorWhenBusy = YES;
@@ -45,9 +45,8 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
// Wed Sep 29 15:31:08 +0000 2010
[RKObjectMapping addDefaultDateFormatterForString:@"E MMM d HH:mm:ss Z y" inTimeZone:nil];
- // Register our mappings with the provider
- [objectManager.mappingProvider setMapping:userMapping forKeyPath:@"user"];
- [objectManager.mappingProvider setMapping:statusMapping forKeyPath:@"status"];
+ // Register our mappings with the provider using a resource path pattern
+ [objectManager.mappingProvider setObjectMapping:statusMapping forResourcePathPattern:@"/status/user_timeline/:username"];
// Uncomment this to use XML, comment it to use JSON
// objectManager.acceptMIMEType = RKMIMETypeXML;
View
10 Examples/RKTwitter/Classes/RKTwitterViewController.m
@@ -18,14 +18,8 @@ @implementation RKTwitterViewController
- (void)loadTimeline {
// Load the object model via RestKit
RKObjectManager* objectManager = [RKObjectManager sharedManager];
- objectManager.client.baseURL = @"http://www.twitter.com";
- [objectManager loadObjectsAtResourcePath:@"/status/user_timeline/RestKit" delegate:self block:^(RKObjectLoader* loader) {
- // Twitter returns statuses as a naked array in JSON, so we instruct the loader
- // to user the appropriate object mapping
- if ([objectManager.acceptMIMEType isEqualToString:RKMIMETypeJSON]) {
- loader.objectMapping = [objectManager.mappingProvider objectMappingForClass:[RKTStatus class]];
- }
- }];
+ objectManager.client.baseURL = [RKURL URLWithString:@"http://www.twitter.com"];
+ [objectManager loadObjectsAtResourcePath:@"/status/user_timeline/RestKit" delegate:self];
}
- (void)loadView {
View
5 Examples/RKTwitterCoreData/Classes/RKTwitterAppDelegate.m
@@ -19,7 +19,7 @@ @implementation RKTwitterAppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Initialize RestKit
- RKObjectManager* objectManager = [RKObjectManager objectManagerWithBaseURL:@"http://twitter.com"];
+ RKObjectManager* objectManager = [RKObjectManager managerWithBaseURLString:@"http://twitter.com"];
// Enable automatic network activity indicator management
objectManager.client.requestQueue.showsNetworkActivityIndicatorWhenBusy = YES;
@@ -68,8 +68,7 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
[RKObjectMapping addDefaultDateFormatterForString:@"E MMM d HH:mm:ss Z y" inTimeZone:nil];
// Register our mappings with the provider
- [objectManager.mappingProvider setMapping:userMapping forKeyPath:@"user"];
- [objectManager.mappingProvider setMapping:statusMapping forKeyPath:@"status"];
+ [objectManager.mappingProvider setObjectMapping:statusMapping forResourcePathPattern:@"/status/user_timeline/:username"];
// Uncomment this to use XML, comment it to use JSON
// objectManager.acceptMIMEType = RKMIMETypeXML;
View
6 Examples/RKTwitterCoreData/Classes/RKTwitterViewController.m
@@ -53,11 +53,7 @@ - (void)loadObjectsFromDataStore {
- (void)loadData {
// Load the object model via RestKit
RKObjectManager* objectManager = [RKObjectManager sharedManager];
- [objectManager loadObjectsAtResourcePath:@"/status/user_timeline/RestKit" delegate:self block:^(RKObjectLoader* loader) {
- // Twitter returns statuses as a naked array in JSON, so we instruct the loader
- // to user the appropriate object mapping
- loader.objectMapping = [objectManager.mappingProvider objectMappingForClass:[RKTStatus class]];
- }];
+ [objectManager loadObjectsAtResourcePath:@"/status/user_timeline/RestKit" delegate:self];
}
- (void)reloadButtonWasPressed:(id)sender {
View
2 Examples/RestKit CLI/RestKit CLI.xcodeproj/project.pbxproj
@@ -7,6 +7,7 @@
objects = {
/* Begin PBXBuildFile section */
+ 250DF27B14C684510001DEFA /* RestKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 25A3422B147D885B0009758D /* RestKit.framework */; };
2516F0FC144A8577004631A1 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2516F0FB144A8577004631A1 /* Foundation.framework */; };
2516F0FF144A8577004631A1 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 2516F0FE144A8577004631A1 /* main.m */; };
2516F103144A8577004631A1 /* RestKit_CLI.1 in CopyFiles */ = {isa = PBXBuildFile; fileRef = 2516F102144A8577004631A1 /* RestKit_CLI.1 */; };
@@ -85,6 +86,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
+ 250DF27B14C684510001DEFA /* RestKit.framework in Frameworks */,
25A34230147D88630009758D /* Security.framework in Frameworks */,
2516F162144A8AED004631A1 /* CoreServices.framework in Frameworks */,
2516F160144A895E004631A1 /* libxml2.dylib in Frameworks */,
View
6 RestKit.xcodeproj/project.pbxproj
@@ -14,6 +14,8 @@
250DF22B14C5190E0001DEFA /* RKOrderedDictionary.h in Headers */ = {isa = PBXBuildFile; fileRef = 250DF22814C5190E0001DEFA /* RKOrderedDictionary.h */; settings = {ATTRIBUTES = (Public, ); }; };
250DF22C14C5190E0001DEFA /* RKOrderedDictionary.m in Sources */ = {isa = PBXBuildFile; fileRef = 250DF22914C5190E0001DEFA /* RKOrderedDictionary.m */; };
250DF22D14C5190E0001DEFA /* RKOrderedDictionary.m in Sources */ = {isa = PBXBuildFile; fileRef = 250DF22914C5190E0001DEFA /* RKOrderedDictionary.m */; };
+ 250DF25F14C680F90001DEFA /* RKObjectMappingProvider+Contexts.h in Headers */ = {isa = PBXBuildFile; fileRef = 250DF25E14C680F90001DEFA /* RKObjectMappingProvider+Contexts.h */; };
+ 250DF26014C680F90001DEFA /* RKObjectMappingProvider+Contexts.h in Headers */ = {isa = PBXBuildFile; fileRef = 250DF25E14C680F90001DEFA /* RKObjectMappingProvider+Contexts.h */; };
2513504E14B8FE6B00A7E893 /* RKConfigurationDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 2513504D14B8FE6B00A7E893 /* RKConfigurationDelegate.h */; settings = {ATTRIBUTES = (Public, ); }; };
2513504F14B8FE6B00A7E893 /* RKConfigurationDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 2513504D14B8FE6B00A7E893 /* RKConfigurationDelegate.h */; settings = {ATTRIBUTES = (Public, ); }; };
25160D1A14564E810060A5C5 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 25160D1914564E810060A5C5 /* Foundation.framework */; };
@@ -566,6 +568,7 @@
250CA67C147D8E800047D347 /* OCHamcrestIOS.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = OCHamcrestIOS.framework; sourceTree = "<group>"; };
250DF22814C5190E0001DEFA /* RKOrderedDictionary.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RKOrderedDictionary.h; sourceTree = "<group>"; };
250DF22914C5190E0001DEFA /* RKOrderedDictionary.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RKOrderedDictionary.m; sourceTree = "<group>"; };
+ 250DF25E14C680F90001DEFA /* RKObjectMappingProvider+Contexts.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "RKObjectMappingProvider+Contexts.h"; sourceTree = "<group>"; };
2513504D14B8FE6B00A7E893 /* RKConfigurationDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RKConfigurationDelegate.h; sourceTree = "<group>"; };
25160D1614564E810060A5C5 /* libRestKit.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libRestKit.a; sourceTree = BUILT_PRODUCTS_DIR; };
25160D1914564E810060A5C5 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
@@ -1113,6 +1116,7 @@
254A62B714AD544200939BEE /* RKObjectPaginator.h */,
254A62B814AD544200939BEE /* RKObjectPaginator.m */,
2513504D14B8FE6B00A7E893 /* RKConfigurationDelegate.h */,
+ 250DF25E14C680F90001DEFA /* RKObjectMappingProvider+Contexts.h */,
);
path = ObjectMapping;
sourceTree = "<group>";
@@ -1687,6 +1691,7 @@
25B408261491CDDC00F21111 /* RKDirectory.h in Headers */,
2513504E14B8FE6B00A7E893 /* RKConfigurationDelegate.h in Headers */,
250DF22A14C5190E0001DEFA /* RKOrderedDictionary.h in Headers */,
+ 250DF25F14C680F90001DEFA /* RKObjectMappingProvider+Contexts.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -1777,6 +1782,7 @@
254A62BA14AD544200939BEE /* RKObjectPaginator.h in Headers */,
2513504F14B8FE6B00A7E893 /* RKConfigurationDelegate.h in Headers */,
250DF22B14C5190E0001DEFA /* RKOrderedDictionary.h in Headers */,
+ 250DF26014C680F90001DEFA /* RKObjectMappingProvider+Contexts.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
View
16 Specs/ObjectMapping/RKObjectLoaderSpec.m
@@ -155,7 +155,7 @@ - (void)testShouldNotCrashWhenLoadingAnErrorResponseWithAnUnmappableMIMEType {
- (void)testShouldLoadAComplexUserObjectWithTargetObject {
RKSpecComplexUser* user = [[RKSpecComplexUser new] autorelease];
- RKObjectManager* objectManager = [RKObjectManager objectManagerWithBaseURL:RKSpecGetBaseURL()];
+ RKObjectManager* objectManager = [RKObjectManager managerWithBaseURL:RKSpecGetBaseURL()];
RKSpecResponseLoader* responseLoader = [RKSpecResponseLoader responseLoader];
RKObjectLoader* objectLoader = [objectManager loaderWithResourcePath:@"/JSON/ComplexNestedUser.json"];
objectLoader.delegate = responseLoader;
@@ -174,7 +174,7 @@ - (void)testShouldLoadAComplexUserObjectWithTargetObject {
}
- (void)testShouldLoadAComplexUserObjectWithoutTargetObject {
- RKObjectManager* objectManager = [RKObjectManager objectManagerWithBaseURL:RKSpecGetBaseURL()];
+ RKObjectManager* objectManager = [RKObjectManager managerWithBaseURL:RKSpecGetBaseURL()];
RKSpecResponseLoader* responseLoader = [RKSpecResponseLoader responseLoader];
RKObjectLoader* objectLoader = [objectManager loaderWithResourcePath:@"/JSON/ComplexNestedUser.json"];
objectLoader.delegate = responseLoader;
@@ -190,7 +190,7 @@ - (void)testShouldLoadAComplexUserObjectWithoutTargetObject {
}
- (void)testShouldLoadAComplexUserObjectUsingRegisteredKeyPath {
- RKObjectManager* objectManager = [RKObjectManager objectManagerWithBaseURL:RKSpecGetBaseURL()];
+ RKObjectManager* objectManager = [RKObjectManager managerWithBaseURL:RKSpecGetBaseURL()];
RKSpecResponseLoader* responseLoader = [RKSpecResponseLoader responseLoader];
RKObjectLoader* objectLoader = [objectManager loaderWithResourcePath:@"/JSON/ComplexNestedUser.json"];
objectLoader.delegate = responseLoader;
@@ -225,7 +225,7 @@ - (void)testShouldInvokeWillSendWithObjectLoaderOnSend {
}
- (void)testShouldInvokeWillSendWithObjectLoaderOnSendAsynchronously {
- RKObjectManager* objectManager = [RKObjectManager objectManagerWithBaseURL:RKSpecGetBaseURL()];
+ RKObjectManager* objectManager = [RKObjectManager managerWithBaseURL:RKSpecGetBaseURL()];
[objectManager setMappingProvider:[self providerForComplexUser]];
RKSpecComplexUser* user = [[RKSpecComplexUser new] autorelease];
id mockObject = [OCMockObject partialMockForObject:user];
@@ -242,7 +242,7 @@ - (void)testShouldInvokeWillSendWithObjectLoaderOnSendAsynchronously {
}
- (void)testShouldInvokeWillSendWithObjectLoaderOnSendSynchronously {
- RKObjectManager* objectManager = [RKObjectManager objectManagerWithBaseURL:RKSpecGetBaseURL()];
+ RKObjectManager* objectManager = [RKObjectManager managerWithBaseURL:RKSpecGetBaseURL()];
[objectManager setMappingProvider:[self providerForComplexUser]];
RKSpecComplexUser* user = [[RKSpecComplexUser new] autorelease];
id mockObject = [OCMockObject partialMockForObject:user];
@@ -458,7 +458,7 @@ - (void)testShouldRespectTheRootKeyPathWhenConstructingATemporaryObjectMappingPr
[userMapping mapAttributes:@"firstname", nil];
RKSpecComplexUser* user = [[RKSpecComplexUser new] autorelease];
- RKObjectManager* objectManager = [RKObjectManager objectManagerWithBaseURL:RKSpecGetBaseURL()];
+ RKObjectManager* objectManager = [RKObjectManager managerWithBaseURL:RKSpecGetBaseURL()];
RKSpecResponseLoader* responseLoader = [RKSpecResponseLoader responseLoader];
RKObjectLoader* objectLoader = [objectManager loaderWithResourcePath:@"/JSON/ComplexNestedUser.json"];
@@ -481,7 +481,7 @@ - (void)testShouldDetermineObjectLoaderBasedOnResourcePathPatternWithExactMatch
[userMapping mapAttributes:@"firstname", nil];
RKSpecComplexUser* user = [[RKSpecComplexUser new] autorelease];
- RKObjectManager* objectManager = [RKObjectManager objectManagerWithBaseURL:RKSpecGetBaseURL()];
+ RKObjectManager* objectManager = [RKObjectManager managerWithBaseURL:RKSpecGetBaseURL()];
RKSpecResponseLoader* responseLoader = [RKSpecResponseLoader responseLoader];
RKObjectMappingProvider *mappingProvider = [RKObjectMappingProvider mappingProvider];
[mappingProvider setObjectMapping:userMapping forResourcePathPattern:@"/JSON/ComplexNestedUser.json"];
@@ -506,7 +506,7 @@ - (void)testShouldDetermineObjectLoaderBasedOnResourcePathPatternWithPartialMatc
[userMapping mapAttributes:@"firstname", nil];
RKSpecComplexUser* user = [[RKSpecComplexUser new] autorelease];
- RKObjectManager* objectManager = [RKObjectManager objectManagerWithBaseURL:RKSpecGetBaseURL()];
+ RKObjectManager* objectManager = [RKObjectManager managerWithBaseURL:RKSpecGetBaseURL()];
RKSpecResponseLoader* responseLoader = [RKSpecResponseLoader responseLoader];
RKObjectMappingProvider *mappingProvider = [RKObjectMappingProvider mappingProvider];
[mappingProvider setObjectMapping:userMapping forResourcePathPattern:@"/JSON/:name\\.json"];
View
2 Specs/ObjectMapping/RKObjectManagerSpec.m
@@ -170,7 +170,7 @@ - (void)testShouldLoadAllHumans {
- (void)testShouldHandleConnectionFailures {
NSString* localBaseURL = [NSString stringWithFormat:@"http://127.0.0.1:3001"];
- RKObjectManager* modelManager = [RKObjectManager objectManagerWithBaseURLString:localBaseURL];
+ RKObjectManager* modelManager = [RKObjectManager managerWithBaseURLString:localBaseURL];
modelManager.client.requestQueue.suspended = NO;
RKSpecResponseLoader* loader = [RKSpecResponseLoader responseLoader];
[modelManager loadObjectsAtResourcePath:@"/JSON/humans/1" delegate:loader];
View
2 Specs/Runner/RKSpecEnvironment.m
@@ -64,7 +64,7 @@ void RKSpecStubNetworkAvailability(BOOL isNetworkAvailable) {
RKObjectManager* RKSpecNewObjectManager(void) {
[RKObjectMapping setDefaultDateFormatters:nil];
- RKObjectManager* objectManager = [RKObjectManager objectManagerWithBaseURL:RKSpecGetBaseURL()];
+ RKObjectManager* objectManager = [RKObjectManager managerWithBaseURL:RKSpecGetBaseURL()];
[RKObjectManager setSharedManager:objectManager];
[RKClient setSharedClient:objectManager.client];
View
BIN Tools/rkkeypath
Binary file not shown.

0 comments on commit 7c5ad95

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