Commit d363bc32 authored by Eloy Duran's avatar Eloy Duran

Update RKTwitter example. ALL EXAMPLES BUILD!

parent cdcbb414
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
// RKTwitter // RKTwitter
// //
// Created by Blake Watters on 9/5/10. // Created by Blake Watters on 9/5/10.
// Copyright 2010 Two Toasters. All rights reserved. // Copyright (c) 2009-2012 RestKit. All rights reserved.
// //
#import "RKTUser.h" #import "RKTUser.h"
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
// RKTwitter // RKTwitter
// //
// Created by Blake Watters on 9/5/10. // Created by Blake Watters on 9/5/10.
// Copyright 2010 Two Toasters. All rights reserved. // Copyright (c) 2009-2012 RestKit. All rights reserved.
// //
#import "RKTStatus.h" #import "RKTStatus.h"
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
// RKTwitter // RKTwitter
// //
// Created by Blake Watters on 9/5/10. // Created by Blake Watters on 9/5/10.
// Copyright 2010 Two Toasters. All rights reserved. // Copyright (c) 2009-2012 RestKit. All rights reserved.
// //
@interface RKTUser : NSObject { @interface RKTUser : NSObject {
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
// RKTwitter // RKTwitter
// //
// Created by Blake Watters on 9/5/10. // Created by Blake Watters on 9/5/10.
// Copyright 2010 Two Toasters. All rights reserved. // Copyright (c) 2009-2012 RestKit. All rights reserved.
// //
#import "RKTUser.h" #import "RKTUser.h"
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
// RKTwitter // RKTwitter
// //
// Created by Blake Watters on 9/5/10. // Created by Blake Watters on 9/5/10.
// Copyright Two Toasters 2010. All rights reserved. // Copyright (c) 2009-2012 RestKit. All rights reserved.
// //
#import <UIKit/UIKit.h> #import <UIKit/UIKit.h>
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
// RKTwitter // RKTwitter
// //
// Created by Blake Watters on 9/5/10. // Created by Blake Watters on 9/5/10.
// Copyright Two Toasters 2010. All rights reserved. // Copyright (c) 2009-2012 RestKit. All rights reserved.
// //
#import <RestKit/RestKit.h> #import <RestKit/RestKit.h>
...@@ -19,11 +19,13 @@ ...@@ -19,11 +19,13 @@
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
RKLogConfigureByName("RestKit/Network*", RKLogLevelTrace); RKLogConfigureByName("RestKit/Network*", RKLogLevelTrace);
RKLogConfigureByName("RestKit/ObjectMapping", RKLogLevelTrace);
// Initialize RestKit // Initialize RestKit
RKObjectManager* objectManager = [RKObjectManager objectManagerWithBaseURL:@"http://twitter.com"]; RKObjectManager* objectManager = [RKObjectManager managerWithBaseURLString:@"http://twitter.com"];
// Enable automatic network activity indicator management // Enable automatic network activity indicator management
//objectManager.client.requestQueue.showsNetworkActivityIndicatorWhenBusy = YES; objectManager.client.requestQueue.showsNetworkActivityIndicatorWhenBusy = YES;
// Setup our object mappings // Setup our object mappings
RKObjectMapping* userMapping = [RKObjectMapping mappingForClass:[RKTUser class]]; RKObjectMapping* userMapping = [RKObjectMapping mappingForClass:[RKTUser class]];
...@@ -43,15 +45,14 @@ ...@@ -43,15 +45,14 @@
// Update date format so that we can parse Twitter dates properly // Update date format so that we can parse Twitter dates properly
// Wed Sep 29 15:31:08 +0000 2010 // Wed Sep 29 15:31:08 +0000 2010
[statusMapping.dateFormatStrings addObject:@"E MMM d HH:mm:ss Z y"]; [RKObjectMapping addDefaultDateFormatterForString:@"E MMM d HH:mm:ss Z y" inTimeZone:nil];
// Register our mappings with the provider // Uncomment these lines to use XML, comment it to use JSON
[objectManager.mappingProvider setMapping:userMapping forKeyPath:@"user"]; // objectManager.acceptMIMEType = RKMIMETypeXML;
[objectManager.mappingProvider setMapping:statusMapping forKeyPath:@"status"]; // statusMapping.rootKeyPath = @"statuses.status";
// Uncomment this to use XML, comment it to use JSON // Register our mappings with the provider using a resource path pattern
// objectManager.acceptMIMEType = RKMIMETypeXML; [objectManager.mappingProvider setObjectMapping:statusMapping forResourcePathPattern:@"/status/user_timeline/:username"];
// [objectManager.mappingProvider setMapping:statusMapping forKeyPath:@"statuses.status"];
// Create Window and View Controllers // Create Window and View Controllers
RKTwitterViewController* viewController = [[[RKTwitterViewController alloc] initWithNibName:nil bundle:nil] autorelease]; RKTwitterViewController* viewController = [[[RKTwitterViewController alloc] initWithNibName:nil bundle:nil] autorelease];
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
// RKTwitter // RKTwitter
// //
// Created by Blake Watters on 9/5/10. // Created by Blake Watters on 9/5/10.
// Copyright Two Toasters 2010. All rights reserved. // Copyright (c) 2009-2012 RestKit. All rights reserved.
// //
#import <UIKit/UIKit.h> #import <UIKit/UIKit.h>
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
// RKTwitter // RKTwitter
// //
// Created by Blake Watters on 9/5/10. // Created by Blake Watters on 9/5/10.
// Copyright Two Toasters 2010. All rights reserved. // Copyright (c) 2009-2012 RestKit. All rights reserved.
// //
#import "RKTwitterViewController.h" #import "RKTwitterViewController.h"
...@@ -18,14 +18,8 @@ ...@@ -18,14 +18,8 @@
- (void)loadTimeline { - (void)loadTimeline {
// Load the object model via RestKit // Load the object model via RestKit
RKObjectManager* objectManager = [RKObjectManager sharedManager]; RKObjectManager* objectManager = [RKObjectManager sharedManager];
objectManager.client.baseURL = @"http://www.twitter.com"; objectManager.client.baseURL = [RKURL URLWithString:@"http://www.twitter.com"];
[objectManager loadObjectsAtResourcePath:@"/status/user_timeline/RestKit" delegate:self block:^(RKObjectLoader* loader) { [objectManager loadObjectsAtResourcePath:@"/status/user_timeline/RestKit" delegate:self];
// 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]];
}
}];
} }
- (void)loadView { - (void)loadView {
......
This diff is collapsed.
PODS: PODS:
- JSONKit (1.4) - FileMD5Hash (0.0.1)
- ISO8601DateFormatter (0.6)
- JSONKit (1.5pre)
- LibComponentLogging-Core (1.1.6) - LibComponentLogging-Core (1.1.6)
- LibComponentLogging-NSLog (1.0.4): - LibComponentLogging-NSLog (1.0.4):
- LibComponentLogging-Core (>= 1.1.6) - LibComponentLogging-Core (>= 1.1.6)
- RestKit/ObjectMapping/JSONKit (0.9.3): - NSData+Base64 (1.0.0)
- JSONKit - RestKit (0.10.0):
- RestKit (= 0.9.3) - RestKit/JSON (= 0.10.0)
- RestKit/ObjectMapping (= 0.9.3) - RestKit/JSON (0.10.0):
- RestKit/Network
DOWNLOAD_ONLY: - RestKit/ObjectMapping/CoreData
- RestKit (0.9.3) - RestKit/ObjectMapping/JSON
- RestKit/Network (0.9.3) - RestKit/UI
- RestKit/ObjectMapping (0.9.3) - RestKit/Network (0.10.0):
- FileMD5Hash
- LibComponentLogging-NSLog (>= 1.0.4)
- SOCKit
- cocoa-oauth
- RestKit/ObjectMapping/CoreData (0.10.0):
- ISO8601DateFormatter (>= 0.6)
- RestKit/Network
- RestKit/ObjectMapping/JSON (0.10.0):
- ISO8601DateFormatter (>= 0.6)
- JSONKit (>= 1.5pre)
- RestKit/Network
- RestKit/UI (0.10.0):
- UDTableView
- SOCKit (1.0)
- UDTableView (1.0.0)
- cocoa-oauth (0.0.1):
- NSData+Base64 (~> 1.0)
DEPENDENCIES: DEPENDENCIES:
- RestKit/ObjectMapping/JSONKit - RestKit
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "1D6058900D05DD3D006BFB54"
BuildableName = "RKTwitter.app"
BlueprintName = "RKTwitter"
ReferencedContainer = "container:RKTwitter.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.GDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.GDB"
shouldUseLaunchSchemeArgsEnv = "YES"
buildConfiguration = "Debug">
<Testables>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "1D6058900D05DD3D006BFB54"
BuildableName = "RKTwitter.app"
BlueprintName = "RKTwitter"
ReferencedContainer = "container:RKTwitter.xcodeproj">
</BuildableReference>
</MacroExpansion>
</TestAction>
<LaunchAction
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.GDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.GDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
buildConfiguration = "Debug"
debugDocumentVersioning = "YES"
allowLocationSimulation = "YES">
<BuildableProductRunnable>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "1D6058900D05DD3D006BFB54"
BuildableName = "RKTwitter.app"
BlueprintName = "RKTwitter"
ReferencedContainer = "container:RKTwitter.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
buildConfiguration = "Release"
debugDocumentVersioning = "YES">
<BuildableProductRunnable>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "1D6058900D05DD3D006BFB54"
BuildableName = "RKTwitter.app"
BlueprintName = "RKTwitter"
ReferencedContainer = "container:RKTwitter.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
// RKTwitter // RKTwitter
// //
// Created by Blake Watters on 9/5/10. // Created by Blake Watters on 9/5/10.
// Copyright Two Toasters 2010. All rights reserved. // Copyright (c) 2009-2012 RestKit. All rights reserved.
// //
#import <UIKit/UIKit.h> #import <UIKit/UIKit.h>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment