Modernize and restore all example projects. closes #1007

This commit is contained in:
Blake Watters
2012-10-25 10:06:33 -04:00
parent 9ef8be412e
commit 4d5d76671c
25 changed files with 261 additions and 213 deletions

View File

@@ -357,6 +357,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ENABLE_OBJC_ARC = YES;
COMBINE_HIDPI_IMAGES = YES;
COPY_PHASE_STRIP = NO;
GCC_DYNAMIC_NO_PIC = NO;
@@ -369,6 +370,7 @@
"$(inherited)",
"\"$(SRCROOT)\"",
);
MACOSX_DEPLOYMENT_TARGET = 10.6.8;
OTHER_LDFLAGS = "-ObjC";
PRODUCT_NAME = "$(TARGET_NAME)";
WRAPPER_EXTENSION = app;
@@ -379,6 +381,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ENABLE_OBJC_ARC = YES;
COMBINE_HIDPI_IMAGES = YES;
COPY_PHASE_STRIP = YES;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
@@ -391,6 +394,7 @@
"$(inherited)",
"\"$(SRCROOT)\"",
);
MACOSX_DEPLOYMENT_TARGET = 10.6.8;
OTHER_LDFLAGS = "-ObjC";
PRODUCT_NAME = "$(TARGET_NAME)";
WRAPPER_EXTENSION = app;

View File

@@ -4,4 +4,6 @@
#ifdef __OBJC__
#import <Cocoa/Cocoa.h>
#import <SystemConfiguration/SystemConfiguration.h>
#import <CoreServices/CoreServices.h>
#endif

View File

@@ -9,9 +9,9 @@
#import <Cocoa/Cocoa.h>
#import <RestKit/RestKit.h>
@interface RKMacOSXAppDelegate : NSObject <NSApplicationDelegate, RKRequestDelegate>
@interface RKMacOSXAppDelegate : NSObject <NSApplicationDelegate>
@property (nonatomic, retain) RKClient *client;
@property (assign) IBOutlet NSWindow *window;
@property (nonatomic, strong) RKObjectManager *objectManager;
@property (unsafe_unretained) IBOutlet NSWindow *window;
@end

View File

@@ -10,24 +10,11 @@
@implementation RKMacOSXAppDelegate
@synthesize client = _client;
@synthesize window = _window;
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
{
// Initialize RestKit
self.client = [RKClient clientWithBaseURL:[RKURL URLWithBaseURLString:@"http://twitter.com"]];
[self.client get:@"/status/user_timeline/RestKit.json" delegate:self];
self.objectManager = [RKObjectManager managerWithBaseURL:[NSURL URLWithString:@"http://twitter.com"]];
}
- (void)request:(RKRequest *)request didLoadResponse:(RKResponse *)response
{
NSLog(@"Loaded JSON: %@", [response bodyAsString]);
}
- (void)dealloc
{
[super dealloc];
}
@end

View File

@@ -11,4 +11,6 @@
#ifdef __OBJC__
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
#import <SystemConfiguration/SystemConfiguration.h>
#import <MobileCoreServices/MobileCoreServices.h>
#endif

View File

@@ -8,49 +8,41 @@
#import "RKTUser.h"
@interface RKTStatus : NSObject {
NSNumber *_statusID;
NSDate *_createdAt;
NSString *_text;
NSString *_urlString;
NSString *_inReplyToScreenName;
NSNumber *_isFavorited;
RKTUser *_user;
}
@interface RKTStatus : NSObject
/**
* The unique ID of this Status
*/
@property (nonatomic, retain) NSNumber *statusID;
@property (nonatomic, copy) NSNumber *statusID;
/**
* Timestamp the Status was sent
*/
@property (nonatomic, retain) NSDate *createdAt;
@property (nonatomic, copy) NSDate *createdAt;
/**
* Text of the Status
*/
@property (nonatomic, retain) NSString *text;
@property (nonatomic, copy) NSString *text;
/**
* String version of the URL associated with the Status
*/
@property (nonatomic, retain) NSString *urlString;
@property (nonatomic, copy) NSString *urlString;
/**
* The screen name of the User this Status was in response to
*/
@property (nonatomic, retain) NSString *inReplyToScreenName;
@property (nonatomic, copy) NSString *inReplyToScreenName;
/**
* Is this status a favorite?
*/
@property (nonatomic, retain) NSNumber *isFavorited;
@property (nonatomic, copy) NSNumber *isFavorited;
/**
* The User who posted this status
*/
@property (nonatomic, retain) RKTUser *user;
@property (nonatomic, strong) RKTUser *user;
@end

View File

@@ -10,29 +10,9 @@
@implementation RKTStatus
@synthesize statusID = _statusID;
@synthesize createdAt = _createdAt;
@synthesize text = _text;
@synthesize urlString = _urlString;
@synthesize inReplyToScreenName = _inReplyToScreenName;
@synthesize isFavorited = _isFavorited;
@synthesize user = _user;
- (NSString *)description
{
return [NSString stringWithFormat:@"%@ (ID: %@)", self.text, self.statusID];
}
- (void)dealloc
{
[_statusID release];
[_createdAt release];
[_text release];
[_urlString release];
[_inReplyToScreenName release];
[_user release];
[super dealloc];
}
@end

View File

@@ -6,14 +6,10 @@
// Copyright (c) 2009-2012 RestKit. All rights reserved.
//
@interface RKTUser : NSObject {
NSNumber *_userID;
NSString *_name;
NSString *_screenName;
}
@interface RKTUser : NSObject
@property (nonatomic, retain) NSNumber *userID;
@property (nonatomic, retain) NSString *name;
@property (nonatomic, retain) NSString *screenName;
@property (nonatomic, copy) NSNumber *userID;
@property (nonatomic, copy) NSString *name;
@property (nonatomic, copy) NSString *screenName;
@end

View File

@@ -9,18 +9,4 @@
#import "RKTUser.h"
@implementation RKTUser
@synthesize userID = _userID;
@synthesize name = _name;
@synthesize screenName = _screenName;
- (void)dealloc
{
[_userID release];
[_name release];
[_screenName release];
[super dealloc];
}
@end

View File

@@ -69,7 +69,7 @@
[objectManager addResponseDescriptor:responseDescriptor];
// Create Window and View Controllers
RKTwitterViewController *viewController = [[[RKTwitterViewController alloc] initWithNibName:nil bundle:nil] autorelease];
RKTwitterViewController *viewController = [[RKTwitterViewController alloc] initWithNibName:nil bundle:nil];
UINavigationController *controller = [[UINavigationController alloc] initWithRootViewController:viewController];
UIWindow *window = [[UIWindow alloc] initWithFrame:CGRectMake(0, 0, 320, 480)];
[window addSubview:controller.view];
@@ -78,10 +78,6 @@
return YES;
}
- (void)dealloc
{
[super dealloc];
}
@end

View File

@@ -25,17 +25,16 @@
success:^(RKObjectRequestOperation *operation, RKMappingResult *mappingResult) {
NSArray* statuses = [mappingResult array];
NSLog(@"Loaded statuses: %@", statuses);
[_statuses release];
_statuses = [statuses retain];
_statuses = statuses;
if(self.isViewLoaded)
[_tableView reloadData];
}
failure:^(RKObjectRequestOperation *operation, NSError *error) {
UIAlertView *alert = [[[UIAlertView alloc] initWithTitle:@"Error"
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Error"
message:[error localizedDescription]
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil] autorelease];
otherButtonTitles:nil];
[alert show];
NSLog(@"Hit error: %@", error);
}];
@@ -49,9 +48,9 @@
self.title = @"RestKit Tweets";
[UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleBlackTranslucent;
self.navigationController.navigationBar.tintColor = [UIColor blackColor];
self.navigationItem.rightBarButtonItem = [[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemRefresh target:self action:@selector(loadTimeline)] autorelease];
self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemRefresh target:self action:@selector(loadTimeline)];
UIImageView *imageView = [[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"BG.png"]] autorelease];
UIImageView *imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"BG.png"]];
imageView.frame = CGRectOffset(imageView.frame, 0, -64);
[self.view insertSubview:imageView atIndex:0];
@@ -66,12 +65,6 @@
[self loadTimeline];
}
- (void)dealloc
{
[_tableView release];
[_statuses release];
[super dealloc];
}
#pragma mark UITableViewDelegate methods
@@ -93,7 +86,7 @@
NSString *reuseIdentifier = @"Tweet Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:reuseIdentifier];
if (nil == cell) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:reuseIdentifier] autorelease];
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:reuseIdentifier];
cell.textLabel.font = [UIFont systemFontOfSize:14];
cell.textLabel.numberOfLines = 0;
cell.textLabel.backgroundColor = [UIColor clearColor];

View File

@@ -343,6 +343,7 @@
isa = XCBuildConfiguration;
buildSettings = {
BUILD_STYLE = Debug;
CLANG_ENABLE_OBJC_ARC = YES;
COPY_PHASE_STRIP = NO;
GCC_DYNAMIC_NO_PIC = NO;
GCC_OPTIMIZATION_LEVEL = 0;
@@ -360,6 +361,7 @@
isa = XCBuildConfiguration;
buildSettings = {
BUILD_STYLE = Release;
CLANG_ENABLE_OBJC_ARC = YES;
COPY_PHASE_STRIP = YES;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = RKTwitter_Prefix.pch;

View File

@@ -5,4 +5,6 @@
#ifdef __OBJC__
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#import <SystemConfiguration/SystemConfiguration.h>
#import <MobileCoreServices/MobileCoreServices.h>
#endif

View File

@@ -10,8 +10,8 @@
int main(int argc, char *argv[]) {
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
int retVal = UIApplicationMain(argc, argv, nil, @"RKTwitterAppDelegate");
[pool release];
return retVal;
@autoreleasepool {
int retVal = UIApplicationMain(argc, argv, nil, @"RKTwitterAppDelegate");
return retVal;
}
}

View File

@@ -9,42 +9,41 @@
#import <RestKit/RestKit.h>
#import <RestKit/CoreData.h>
@interface RKTStatus : NSManagedObject {
}
@interface RKTStatus : NSManagedObject
/**
* The unique ID of this Status
The unique ID of this Status
*/
@property (nonatomic, retain) NSNumber *statusID;
@property (nonatomic, copy) NSNumber *statusID;
/**
* Timestamp the Status was sent
Timestamp the Status was sent
*/
@property (nonatomic, retain) NSDate *createdAt;
@property (nonatomic, copy) NSDate *createdAt;
/**
* Text of the Status
Text of the Status
*/
@property (nonatomic, retain) NSString *text;
@property (nonatomic, copy) NSString *text;
/**
* String version of the URL associated with the Status
String version of the URL associated with the Status
*/
@property (nonatomic, retain) NSString *urlString;
@property (nonatomic, copy) NSString *urlString;
/**
* The screen name of the User this Status was in response to
The screen name of the User this Status was in response to
*/
@property (nonatomic, retain) NSString *inReplyToScreenName;
@property (nonatomic, copy) NSString *inReplyToScreenName;
/**
* Is this status a favorite?
Is this status a favorite?
*/
@property (nonatomic, assign) BOOL isFavorited;
/**
* The User who posted this status
The User who posted this status
*/
@property (nonatomic, retain) NSManagedObject *user;
@property (nonatomic, strong) NSManagedObject *user;
@end

View File

@@ -8,9 +8,5 @@
#import <UIKit/UIKit.h>
@interface RKTwitterAppDelegate : NSObject <UIApplicationDelegate> {
}
@interface RKTwitterAppDelegate : UIResponder <UIApplicationDelegate>
@end

View File

@@ -14,6 +14,8 @@
@implementation RKTwitterAppDelegate
@synthesize window;
#pragma mark -
#pragma mark Application lifecycle
@@ -23,44 +25,51 @@
NSURL *baseURL = [NSURL URLWithString:@"http://twitter.com"];
RKObjectManager *objectManager = [RKObjectManager managerWithBaseURL:baseURL];
// Enable automatic network activity indicator management
objectManager.client.requestQueue.showsNetworkActivityIndicatorWhenBusy = YES;
// Enable Activity Indicator Spinner
[AFNetworkActivityIndicatorManager sharedManager].enabled = YES;
// Initialize managed object store
NSManagedObjectModel *managedObjectModel = [NSManagedObjectModel mergedModelFromBundles:nil];
RKManagedObjectStore *managedObjectStore = [[RKManagedObjectStore alloc] initWithManagedObjectModel:managedObjectModel];
objectManager.managedObjectStore = managedObjectStore;
[managedObjectStore release];
// Setup our object mappings
/*!
/**
Mapping by entity. Here we are configuring a mapping by targetting a Core Data entity with a specific
name. This allows us to map back Twitter user objects directly onto NSManagedObject instances --
there is no backing model class!
*/
RKEntityMapping *userMapping = [RKEntityMapping mappingForEntityForName:@"RKTUser" inManagedObjectStore:managedObjectStore];
userMapping.primaryKeyAttribute = @"userID";
[userMapping mapKeyPath:@"id" toAttribute:@"userID"];
[userMapping mapKeyPath:@"screen_name" toAttribute:@"screenName"];
[userMapping mapAttributes:@"name", nil];
[userMapping addAttributeMappingsFromDictionary:@{
@"id": @"userID",
@"screen_name": @"screenName",
}];
// If source and destination key path are the same, we can simply add a string to the array
[userMapping addAttributeMappingsFromArray:@[ @"name" ]];
RKEntityMapping *statusMapping = [RKEntityMapping mappingForEntityForName:@"RKTStatus" inManagedObjectStore:managedObjectStore];
statusMapping.primaryKeyAttribute = @"statusID";
[statusMapping mapKeyPathsToAttributes:@"id", @"statusID",
@"created_at", @"createdAt",
@"text", @"text",
@"url", @"urlString",
@"in_reply_to_screen_name", @"inReplyToScreenName",
@"favorited", @"isFavorited",
nil];
[statusMapping mapRelationship:@"user" withMapping:userMapping];
[statusMapping addAttributeMappingsFromDictionary:@{
@"id": @"statusID",
@"created_at": @"createdAt",
@"text": @"text",
@"url": @"urlString",
@"in_reply_to_screen_name": @"inReplyToScreenName",
@"favorited": @"isFavorited",
}];
[statusMapping addPropertyMapping:[RKRelationshipMapping relationshipMappingFromKeyPath:@"user" toKeyPath:@"user" withMapping:userMapping]];
// Update date format so that we can parse Twitter dates properly
// 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 setObjectMapping:statusMapping forResourcePathPattern:@"/status/user_timeline/:username"];
RKResponseDescriptor *responseDescriptor = [RKResponseDescriptor responseDescriptorWithMapping:statusMapping
pathPattern:@"/status/user_timeline/:username"
keyPath:nil
statusCodes:RKStatusCodeIndexSetForClass(RKStatusCodeClassSuccessful)];
[objectManager addResponseDescriptor:responseDescriptor];
// Uncomment this to use XML, comment it to use JSON
// objectManager.acceptMIMEType = RKMIMETypeXML;
@@ -93,6 +102,8 @@
} else {
RKLogError(@"Failed to finish import and save seed database due to error: %@", error);
}
exit(0);
#else
/**
Complete Core Data stack initialization
@@ -108,16 +119,9 @@
[managedObjectStore createManagedObjectContexts];
// Configure a managed object cache to ensure we do not create duplicate objects
managedObjectStore.managedObjectCache = [[RKInMemoryManagedObjectCache alloc] initWithManagedObjectContext:managedObjectStore.primaryManagedObjectContext];
managedObjectStore.managedObjectCache = [[RKInMemoryManagedObjectCache alloc] initWithManagedObjectContext:managedObjectStore.persistentStoreManagedObjectContext];
#endif
// Create Window and View Controllers
RKTwitterViewController *viewController = [[[RKTwitterViewController alloc] initWithNibName:nil bundle:nil] autorelease];
UINavigationController *controller = [[UINavigationController alloc] initWithRootViewController:viewController];
UIWindow *window = [[UIWindow alloc] initWithFrame:CGRectMake(0, 0, 320, 480)];
[window addSubview:controller.view];
[window makeKeyAndVisible];
return YES;
}

View File

@@ -10,5 +10,4 @@
#import <RestKit/RestKit.h>
@interface RKTwitterViewController : UIViewController
- (void)loadObjectsFromDataStore;
@end

View File

@@ -9,97 +9,78 @@
#import "RKTwitterViewController.h"
#import "RKTStatus.h"
@interface RKTwitterViewController () <UITableViewDelegate, UITableViewDataSource, RKObjectLoaderDelegate>
@property (nonatomic, retain) UITableView *tableView;
@property (nonatomic, retain) NSArray *statuses;
static void RKTwitterShowAlertWithError(NSError *error)
{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Error"
message:[error localizedDescription]
delegate:nil
cancelButtonTitle:@"OK" otherButtonTitles:nil];
[alert show];
}
@interface RKTwitterViewController () <UITableViewDelegate, UITableViewDataSource>
@property (nonatomic, weak) IBOutlet UITableView *tableView;
@property (nonatomic, strong) NSFetchedResultsController *fetchedResultsController;
@end
@implementation RKTwitterViewController
@synthesize tableView = _tableView;
@synthesize statuses = _statuses;
- (void)loadView
- (void)viewDidLoad
{
[super loadView];
[super viewDidLoad];
// Set debug logging level. Set to 'RKLogLevelTrace' to see JSON payload
RKLogConfigureByName("RestKit/Network", RKLogLevelDebug);
// Setup View and Table View
self.title = @"RestKit Tweets";
[UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleBlackTranslucent;
self.navigationController.navigationBar.tintColor = [UIColor blackColor];
self.navigationItem.rightBarButtonItem = [[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemRefresh target:self action:@selector(reloadButtonWasPressed:)] autorelease];
UIImageView *imageView = [[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"BG.png"]] autorelease];
imageView.frame = CGRectOffset(imageView.frame, 0, -64);
[self.view insertSubview:imageView atIndex:0];
self.tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, 320, 480-64) style:UITableViewStylePlain];
self.tableView.dataSource = self;
self.tableView.delegate = self;
self.tableView.backgroundColor = [UIColor clearColor];
self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
[self.view addSubview:self.tableView];
// Load statuses from core data
[self loadObjectsFromDataStore];
}
- (void)dealloc
{
[_tableView release];
[_statuses release];
[super dealloc];
}
- (void)loadObjectsFromDataStore
{
NSFetchRequest *fetchRequest = [NSFetchRequest fetchRequestWithEntityName:@"RKTStatus"];
NSSortDescriptor *descriptor = [NSSortDescriptor sortDescriptorWithKey:@"createdAt" ascending:NO];
fetchRequest.sortDescriptors = @[descriptor];
NSError *error;
self.statuses = [[RKManagedObjectStore defaultStore].mainQueueManagedObjectContext executeFetchRequest:fetchRequest error:&error];
NSError *error = nil;
// Setup fetched results
self.fetchedResultsController = [[NSFetchedResultsController alloc] initWithFetchRequest:fetchRequest
managedObjectContext:[RKManagedObjectStore defaultStore].mainQueueManagedObjectContext
sectionNameKeyPath:nil
cacheName:nil];
BOOL fetchSuccessful = [self.fetchedResultsController performFetch:&error];
if (! fetchSuccessful) {
RKTwitterShowAlertWithError(error);
}
[self loadData];
}
- (void)loadData
{
// Load the object model via RestKit
RKObjectManager *objectManager = [RKObjectManager sharedManager];
[objectManager loadObjectsAtResourcePath:@"/status/user_timeline/RestKit" delegate:self];
[[RKObjectManager sharedManager] getObjectsAtPath:@"/status/user_timeline/RestKit" parameters:nil success:^(RKObjectRequestOperation *operation, RKMappingResult *mappingResult) {
RKLogInfo(@"Load complete: Table should refresh...");
[[NSUserDefaults standardUserDefaults] setObject:[NSDate date] forKey:@"LastUpdatedAt"];
[[NSUserDefaults standardUserDefaults] synchronize];
} failure:^(RKObjectRequestOperation *operation, NSError *error) {
RKLogError(@"Load failed with error: %@", error);
RKTwitterShowAlertWithError(error);
}];
}
- (void)reloadButtonWasPressed:(id)sender
- (IBAction)refresh:(id)sender
{
// Load the object model via RestKit
[self loadData];
}
#pragma mark RKObjectLoaderDelegate methods
- (void)objectLoader:(RKObjectLoader *)objectLoader didLoadObjects:(NSArray *)objects
{
[[NSUserDefaults standardUserDefaults] setObject:[NSDate date] forKey:@"LastUpdatedAt"];
[[NSUserDefaults standardUserDefaults] synchronize];
NSLog(@"Loaded statuses: %@", objects);
[self loadObjectsFromDataStore];
[_tableView reloadData];
}
- (void)objectLoader:(RKObjectLoader *)objectLoader didFailWithError:(NSError *)error
{
UIAlertView *alert = [[[UIAlertView alloc] initWithTitle:@"Error"
message:[error localizedDescription]
delegate:nil
cancelButtonTitle:@"OK" otherButtonTitles:nil] autorelease];
[alert show];
NSLog(@"Hit error: %@", error);
}
#pragma mark UITableViewDelegate methods
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
CGSize size = [[[_statuses objectAtIndex:indexPath.row] text] sizeWithFont:[UIFont systemFontOfSize:14] constrainedToSize:CGSizeMake(300, 9000)];
RKTStatus *status = [self.fetchedResultsController objectAtIndexPath:indexPath];
CGSize size = [[status text] sizeWithFont:[UIFont systemFontOfSize:14] constrainedToSize:CGSizeMake(300, 9000)];
return size.height + 10;
}
@@ -107,7 +88,8 @@
- (NSInteger)tableView:(UITableView *)table numberOfRowsInSection:(NSInteger)section
{
return [_statuses count];
id<NSFetchedResultsSectionInfo> sectionInfo = [self.fetchedResultsController.sections objectAtIndex:section];
return [sectionInfo numberOfObjects];
}
- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section
@@ -125,13 +107,13 @@
NSString *reuseIdentifier = @"Tweet Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:reuseIdentifier];
if (nil == cell) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:reuseIdentifier] autorelease];
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:reuseIdentifier];
cell.textLabel.font = [UIFont systemFontOfSize:14];
cell.textLabel.numberOfLines = 0;
cell.textLabel.backgroundColor = [UIColor clearColor];
cell.contentView.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"listbg.png"]];
}
RKTStatus *status = [_statuses objectAtIndex:indexPath.row];
RKTStatus *status = [self.fetchedResultsController objectAtIndexPath:indexPath];
cell.textLabel.text = status.text;
return cell;
}

View File

@@ -16,6 +16,8 @@
25014086153707E2004E0466 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CD39C14D14EEED8700E84874 /* QuartzCore.framework */; };
250CA6CE147D90BA0047D347 /* libRestKit.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 250CA6C6147D90A50047D347 /* libRestKit.a */; };
250CA6D0147D90C50047D347 /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 250CA6CF147D90C50047D347 /* Security.framework */; };
252E157D16397DCA000B729E /* MainStoryboard.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 2536AF3B16397A0200AD803D /* MainStoryboard.storyboard */; };
2536AF3C16397A0200AD803D /* MainStoryboard.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 2536AF3B16397A0200AD803D /* MainStoryboard.storyboard */; };
2538E814123419EC00ACB5D7 /* RKTStatus.m in Sources */ = {isa = PBXBuildFile; fileRef = 2538E813123419EC00ACB5D7 /* RKTStatus.m */; };
2538E865123424F000ACB5D7 /* CoreData.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2538E864123424F000ACB5D7 /* CoreData.framework */; };
2538E8671234250100ACB5D7 /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2538E8661234250100ACB5D7 /* SystemConfiguration.framework */; };
@@ -107,6 +109,7 @@
1D6058910D05DD3D006BFB54 /* RKTwitterCoreData.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = RKTwitterCoreData.app; sourceTree = BUILT_PRODUCTS_DIR; };
1DF5F4DF0D08C38300B7A737 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };
250CA6CF147D90C50047D347 /* Security.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Security.framework; path = System/Library/Frameworks/Security.framework; sourceTree = SDKROOT; };
2536AF3B16397A0200AD803D /* MainStoryboard.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = MainStoryboard.storyboard; sourceTree = "<group>"; };
2538E7FF123417E500ACB5D7 /* RestKit.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RestKit.xcodeproj; path = ../../RestKit.xcodeproj; sourceTree = SOURCE_ROOT; };
2538E812123419EC00ACB5D7 /* RKTStatus.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RKTStatus.h; sourceTree = "<group>"; };
2538E813123419EC00ACB5D7 /* RKTStatus.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RKTStatus.m; sourceTree = "<group>"; };
@@ -243,6 +246,7 @@
3F3CE3FB125B9A6E0083FDCB /* listbg@2x.png */,
8D1107310486CEB800E47090 /* RKTwitter-Info.plist */,
3F94E0C6125BA8C0001E8585 /* RKTwitterCoreData.xcdatamodel */,
2536AF3B16397A0200AD803D /* MainStoryboard.storyboard */,
);
path = Resources;
sourceTree = "<group>";
@@ -380,6 +384,7 @@
3F3CE410125B9B450083FDCB /* Default.png in Resources */,
3F3CE411125B9B450083FDCB /* Default@2x.png in Resources */,
25F2A2D913240CEC00A33DE4 /* RKSeedDatabase.sqlite in Resources */,
2536AF3C16397A0200AD803D /* MainStoryboard.storyboard in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -395,6 +400,7 @@
25F2A17D1322D59400A33DE4 /* Default.png in Resources */,
25F2A17E1322D59400A33DE4 /* Default@2x.png in Resources */,
25F2A1991322D93500A33DE4 /* restkit.json in Resources */,
252E157D16397DCA000B729E /* MainStoryboard.storyboard in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -445,6 +451,7 @@
isa = XCBuildConfiguration;
buildSettings = {
BUILD_STYLE = Debug;
CLANG_ENABLE_OBJC_ARC = YES;
COPY_PHASE_STRIP = NO;
GCC_DYNAMIC_NO_PIC = NO;
GCC_OPTIMIZATION_LEVEL = 0;
@@ -461,6 +468,7 @@
isa = XCBuildConfiguration;
buildSettings = {
BUILD_STYLE = Release;
CLANG_ENABLE_OBJC_ARC = YES;
COPY_PHASE_STRIP = YES;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = RKTwitter_Prefix.pch;
@@ -476,6 +484,7 @@
isa = XCBuildConfiguration;
buildSettings = {
BUILD_STYLE = Debug;
CLANG_ENABLE_OBJC_ARC = YES;
COPY_PHASE_STRIP = NO;
GCC_DYNAMIC_NO_PIC = NO;
GCC_OPTIMIZATION_LEVEL = 0;
@@ -493,6 +502,7 @@
isa = XCBuildConfiguration;
buildSettings = {
BUILD_STYLE = Release;
CLANG_ENABLE_OBJC_ARC = YES;
COPY_PHASE_STRIP = YES;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = RKTwitter_Prefix.pch;

View File

@@ -5,4 +5,7 @@
#ifdef __OBJC__
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#import <CoreData/CoreData.h>
#import <SystemConfiguration/SystemConfiguration.h>
#import <MobileCoreServices/MobileCoreServices.h>
#endif

View File

@@ -0,0 +1,90 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="2.0" toolsVersion="2843" systemVersion="12C60" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" initialViewController="Dvq-rA-0Mv">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="1929"/>
</dependencies>
<scenes>
<!--Navigation Controller-->
<scene sceneID="M9A-m5-O3F">
<objects>
<navigationController definesPresentationContext="YES" id="Dvq-rA-0Mv" sceneMemberID="viewController">
<navigationBar key="navigationBar" contentMode="scaleToFill" barStyle="blackTranslucent" id="rD1-7I-BA4">
<autoresizingMask key="autoresizingMask"/>
<color key="tintColor" white="0.0" alpha="1" colorSpace="calibratedWhite"/>
</navigationBar>
<connections>
<segue destination="SSJ-De-MIy" kind="relationship" relationship="rootViewController" id="Asy-b3-2v1"/>
</connections>
</navigationController>
<placeholder placeholderIdentifier="IBFirstResponder" id="TIa-39-he5" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="74" y="13"/>
</scene>
<!--Twitter View Controller-->
<scene sceneID="QQl-Jl-slk">
<objects>
<viewController id="SSJ-De-MIy" customClass="RKTwitterViewController" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="FBz-Pc-zyO">
<rect key="frame" x="0.0" y="20" width="320" height="548"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" image="BG.png" translatesAutoresizingMaskIntoConstraints="NO" id="QMe-h7-zHE">
<constraints>
<constraint firstAttribute="height" constant="568" id="xqS-mC-icU"/>
</constraints>
</imageView>
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="none" allowsSelection="NO" rowHeight="44" sectionHeaderHeight="22" sectionFooterHeight="22" translatesAutoresizingMaskIntoConstraints="NO" id="EGy-lH-ixA">
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
<connections>
<outlet property="dataSource" destination="SSJ-De-MIy" id="q2Z-wZ-TZF"/>
<outlet property="delegate" destination="SSJ-De-MIy" id="5yK-u5-sH9"/>
</connections>
</tableView>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
<constraints>
<constraint firstItem="EGy-lH-ixA" firstAttribute="top" secondItem="FBz-Pc-zyO" secondAttribute="top" type="default" id="4ug-6z-oFF"/>
<constraint firstItem="QMe-h7-zHE" firstAttribute="bottom" secondItem="FBz-Pc-zyO" secondAttribute="bottom" type="default" id="Ck6-7L-f1F"/>
<constraint firstItem="EGy-lH-ixA" firstAttribute="leading" secondItem="FBz-Pc-zyO" secondAttribute="leading" type="default" id="HYh-p1-6qu"/>
<constraint firstItem="EGy-lH-ixA" firstAttribute="trailing" secondItem="FBz-Pc-zyO" secondAttribute="trailing" type="default" id="PXc-fk-Lte"/>
<constraint firstItem="EGy-lH-ixA" firstAttribute="bottom" secondItem="FBz-Pc-zyO" secondAttribute="bottom" type="default" id="ilU-ZA-2sp"/>
<constraint firstItem="QMe-h7-zHE" firstAttribute="leading" secondItem="FBz-Pc-zyO" secondAttribute="leading" type="default" id="rlZ-cm-QgD"/>
</constraints>
</view>
<navigationItem key="navigationItem" id="lYI-Ww-tcJ">
<barButtonItem key="rightBarButtonItem" systemItem="refresh" id="9Sq-Uv-U1H">
<connections>
<action selector="refresh:" destination="SSJ-De-MIy" id="fZU-gs-oAi"/>
</connections>
</barButtonItem>
</navigationItem>
<connections>
<outlet property="tableView" destination="EGy-lH-ixA" id="Fdz-er-tsW"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="9MF-fk-I9D" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="559" y="13"/>
</scene>
</scenes>
<resources>
<image name="BG.png" width="320" height="480"/>
</resources>
<classes>
<class className="NSLayoutConstraint" superclassName="NSObject">
<source key="sourceIdentifier" type="project" relativePath="./Classes/NSLayoutConstraint.h"/>
</class>
<class className="RKTwitterViewController" superclassName="UIViewController">
<source key="sourceIdentifier" type="project" relativePath="./Classes/RKTwitterViewController.h"/>
<relationships>
<relationship kind="action" name="refresh:"/>
<relationship kind="outlet" name="tableView" candidateClass="UITableView"/>
</relationships>
</class>
</classes>
<simulatedMetricsContainer key="defaultSimulatedMetrics">
<simulatedStatusBarMetrics key="statusBar"/>
<simulatedOrientationMetrics key="orientation"/>
<simulatedScreenMetrics key="destination" type="retina4"/>
</simulatedMetricsContainer>
</document>

View File

@@ -24,5 +24,7 @@
<string>1.0</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UIMainStoryboardFile</key>
<string>MainStoryboard</string>
</dict>
</plist>

View File

@@ -10,8 +10,8 @@
int main(int argc, char *argv[]) {
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
int retVal = UIApplicationMain(argc, argv, nil, @"RKTwitterAppDelegate");
[pool release];
return retVal;
@autoreleasepool {
int retVal = UIApplicationMain(argc, argv, nil, @"RKTwitterAppDelegate");
return retVal;
}
}

View File

@@ -1 +1,22 @@
<?xml version='1.0' encoding='UTF-8'?><Workspace version='1.0'><FileRef location='group:RestKit.xcodeproj'/><FileRef location='group:Pods/Pods.xcodeproj'/></Workspace>
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "group:RestKit.xcodeproj">
</FileRef>
<FileRef
location = "group:Pods/Pods.xcodeproj">
</FileRef>
<FileRef
location = "group:Examples/RKTwitter/RKTwitter.xcodeproj">
</FileRef>
<FileRef
location = "group:Examples/RKTwitterCoreData/RKTwitterCoreData.xcodeproj">
</FileRef>
<FileRef
location = "group:Examples/RKSearchExample/RKSearchExample.xcodeproj">
</FileRef>
<FileRef
location = "group:Examples/RKMacOSX/RKMacOSX.xcodeproj">
</FileRef>
</Workspace>