Attempting to use table view in ios, getting error - iphone

I have a table view in my iOS tabbed application, but I can't run the app, I get this error at runtime:
3/23/12 10:15:23.119 PM CodeCompanion: *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '-[UITableViewController loadView] loaded the "2-view-16" nib but didn't get a UITableView.'
*** First throw call stack:
(0x13bd052 0x154ed0a 0x1365a78 0x13659e9 0x2436ae 0xda5cb 0xf5b89 0xf59bd 0xf3f8a 0xf3e2f 0xf1ffb 0xf285a 0xdbfbf 0xdc21b 0xdd0f1 0x4bfec 0x51572 0x4b72b 0x3abc2 0x3ace2 0x3aea8 0x41d9a 0x12be6 0x138a6 0x22743 0x231f8 0x16aa9 0x12a7fa9 0x13911c5 0x12f6022 0x12f490a 0x12f3db4 0x12f3ccb 0x132a7 0x14a9b 0x2888 0x27e5)
My View Controller header file is below:
#import <UIKit/UIKit.h>
#class LanguageTableViewCell;
#interface LanguagesViewController : UITableViewController {
NSArray *languages;
}
#property (nonatomic, retain) NSArray *languages;
#end
and my implementation file is:
#import "LanguagesViewController.h"
#import "LanguageTableViewCell.h"
#implementation LanguagesViewController
#synthesize languages;
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
NSLog(#"getting cell for row at index path: %i", [indexPath row]);
LanguageTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:#"languageBase"];
if (cell == nil) {
cell = [[LanguageTableViewCell alloc]
initWithStyle:UITableViewCellStyleDefault
reuseIdentifier:#"languageBase"];
}
[cell setName:[languages objectAtIndex:[indexPath row]]];
return cell;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
NSLog(#"rows in section: %i is: %i", section, [languages count]);
return [languages count];
}
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
// Return the number of sections.
NSLog(#"getting number of sections (1)");
return 1;
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Release any cached data, images, etc that aren't in use.
}
#pragma mark - View lifecycle
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
NSLog(#"view loaded, setting array");
languages = [NSArray arrayWithObjects:#"Java", nil];
}
- (void)viewDidUnload
{
[super viewDidUnload];
// Release any retained subviews of the main view.
// e.g. self.myOutlet = nil;
}
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
}
- (void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];
}
- (void)viewWillDisappear:(BOOL)animated
{
[super viewWillDisappear:animated];
}
- (void)viewDidDisappear:(BOOL)animated
{
[super viewDidDisappear:animated];
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
// Return YES for supported orientations
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);
} else {
return YES;
}
}
#end
I'm pretty new to xcode and objective-c, so mention anything that could have gone wrong. I have set the ViewController of the table view to my above class, and I am not getting any errors or warnings in xcode. The table view is one of those dynamic ones that use prototype cells. If I need to post the class of the cell, I will.

By the looks of your error message you're using a nib file, "2-view-16", to layout your view but it doesn't contain a UITableView (or it isn't hooked up).
The LanguagesViewController inherits from UITableViewController which is looking for a UITableView to control which doesn't exist.
If you're using a nib to setup the view, you'll need to add a UITableView to the nib and set it to be the tableView of your LanguagesViewController.

Related

UITableView: error after connected table view to datasource

I'm trying to create a simple TableView in my current project.
but I got this error after connected datasource in IB and run iOS simulator.
2013-03-22 14:58:32.372 M[1875:c07] -[ViewController tableView:numberOfRowsInSection:]:
unrecognized selector sent to instance 0x88191f0
2013-03-22 14:58:32.374 M[1875:c07] *** Terminating app due to uncaught exception
'NSInvalidArgumentException', reason: '-[ViewController tableView:numberOfRowsInSection:]:
unrecognized selector sent to instance 0x88191f0'
,but when I create a simple TableView in an empty project with the same code it's working.
Here is my code
"MCEventActivityViewController.h"
#import <UIKit/UIKit.h>
#interface MCEventActivityViewController : UIViewController <UITableViewDelegate, UITableViewDataSource>
#end
"MCEventActivityViewController.m"
#import "MCEventActivityViewController.h"
#interface MCEventActivityViewController ()
#end
#implementation MCEventActivityViewController
{
NSArray *tableData;
}
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view from its nib.
tableData = [NSArray arrayWithObjects:#"1", #"2", #"3", nil];
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return [tableData count];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *simpleTableIdentifier = #"SimpleTableItem";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:simpleTableIdentifier];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:simpleTableIdentifier];
}
cell.textLabel.text = [tableData objectAtIndex:indexPath.row];
return cell;
}
#end
Could anyone help me figure out why this error came out?
The screenshots are here.
Edited:
Make sure,
1.TableView is connected with FileOwner in XIB.
2.#interface Controller : UIViewController UITableViewDelegate,UITableViewDataSource included.
3.Delegate & DataSource both connected with FileOwner.
4.numberOfSections return 1.
5.numberOfRowsInSection returns [required].
6.cellForRowAtIndexPath
{ data goes here...
}
Edited:
Create,
#property (nonatomic,strong) IBOutlet UITabelView * tableView;
and connect this Outlet in Xib with Fileowner
Add numberOfSectionsInTableView method to your code
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
// Return the number of sections.
return 1;
}
Add NSArray *tableData; to MCEventActivityViewController.h
and set its #property and #synthesize properly.
and write
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view from its nib.
self.tableData = [[NSArray alloc] initWithObjects:#"1", #"2", #"3", nil];
}
You should link the (dataSource and delegate) from Outlets to the view controller not to view ! like these pictures :

tableviewcellForRowAtIndexPath is not being called

I have this basic shopping list app where in the first view there are two text fields. One that is the name of the item and the other is the item quantitiy. Once the user types those two entries and presses the save button, the app segues to the table view controller where the entries are stored first into an object called item, and then the object is stored into an array of items. Then I implement all the required table view methods and have the item displayed in a table view. Sadly, nothing is being displayed. When I save an entry the table view appears blank. After doing some debugging with NSLog's, I figured out that the crucial method tableviewcellForRowAtIndexPath is not being called. I found that others had a similar question and that the solution was to set the tableviewcontroller as the delegate, I tried that but it didn't work. Do you know what's wrong with my code? Thanks.
Here is my view controller for the first image, then I will show you my tableviewController code
#import "TVViewController.h"
#import "TableViewController.h"
//#import "TableViewController.m"
#implementation TVViewController
#synthesize title;//one of the text fields
#synthesize subtitle;//the other text field
-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
if ([segue.identifier isEqualToString:#"Save"]) {
NSString *string1 = self.title.text;
NSString *string2 = self.subtitle.text;
[segue.destinationViewController addName: string1 andNumber:string2];
}
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Release any cached data, images, etc that aren't in use.
}
#pragma mark - View lifecycle
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
}
- (void)viewDidUnload
{
[self setTitle:nil];
[self setSubtitle:nil];
[super viewDidUnload];
// Release any retained subviews of the main view.
// e.g. self.myOutlet = nil;
}
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
}
- (void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];
}
- (void)viewWillDisappear:(BOOL)animated
{
[super viewWillDisappear:animated];
}
- (void)viewDidDisappear:(BOOL)animated
{
[super viewDidDisappear:animated];
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
// Return YES for supported orientations
return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);
}
#end
That is my viewcontroller
This is my table view controller, ignore the nslog's those were for debugging purposes
#import "TableViewController.h"
#import "Item.h"
#implementation TableViewController
#synthesize items;
-(void) addName:(NSString *) name
andNumber:(NSString *) numberOfItems
{
Item *item = [[Item alloc] init];
item.itemName = name;
item.itemQuantity = numberOfItems;
[self.items addObject:item];
NSLog(#"Data has been passed");
}
- (id)initWithStyle:(UITableViewStyle)style
{
self = [super initWithStyle:style];
if (self) {
}
return self;
}
- (void)didReceiveMemoryWarning
{
// Releases the view if it doesn't have a superview.
[super didReceiveMemoryWarning];
// Release any cached data, images, etc that aren't in use.
}
#pragma mark - View lifecycle
- (void)viewDidLoad
{
[super viewDidLoad];
NSLog(#"VIew is ready");
//[self.tableView reloadData];
// Uncomment the following line to preserve selection between presentations.
// self.clearsSelectionOnViewWillAppear = NO;
// Uncomment the following line to display an Edit button in the navigation bar for this view controller.
// self.navigationItem.rightBarButtonItem = self.editButtonItem;
}
- (void)viewDidUnload
{
[super viewDidUnload];
// Release any retained subviews of the main view.
// e.g. self.myOutlet = nil;
}
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
}
- (void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];
}
- (void)viewWillDisappear:(BOOL)animated
{
[super viewWillDisappear:animated];
}
- (void)viewDidDisappear:(BOOL)animated
{
[super viewDidDisappear:animated];
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
// Return YES for supported orientations
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
#pragma mark - Table view data source
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
NSLog(#"list initialized by count");
// Return the number of rows in the section.
return [self.items count];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = #"Item in cart";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
}
// Configure the cell...
Item *item = [self.items objectAtIndex:indexPath.row];
cell.textLabel.text = item.itemName;
cell.detailTextLabel.text = item.itemQuantity;
return cell;
}
as far as I remember you need to set tableVeiw's dataSource for this, delegate is for recieveing events
http://developer.apple.com/library/ios/#documentation/uikit/reference/UITableViewDataSource_Protocol/Reference/Reference.html#//apple_ref/occ/intf/UITableViewDataSource

UItbaleview Cell json contents not displayed in iOS

I created an app which will fetch info from web service.So far i got it by displaying the contents using NSLog but when i tried to load it in UITableViewCell its not displayed.Here is my code for that
#import "TableViewController.h"
#import "JSON.h"
#import "SBJsonParser.h"
#interface TableViewController ()
#end
#implementation TableViewController
#synthesize jsonurl,jsondata,jsonarray;
- (id)initWithStyle:(UITableViewStyle)style
{
self = [super initWithStyle:style];
if (self) {
}
jsonurl=[NSURL URLWithString:#"http://minorasarees.com/category.php"];
jsondata=[[NSString alloc]initWithContentsOfURL:jsonurl];
self.jsonarray=[jsondata JSONValue];
return self;
}
- (void)viewDidLoad
{
[super viewDidLoad];
// Uncomment the following line to preserve selection between presentations.
// self.clearsSelectionOnViewWillAppear = NO;
// Uncomment the following line to display an Edit button in the navigation bar for this view controller.
// self.navigationItem.rightBarButtonItem = self.editButtonItem;
}
- (void)viewDidUnload
{
[super viewDidUnload];
// Release any retained subviews of the main view.
// e.g. self.myOutlet = nil;
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
#pragma mark - Table view data source
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
// Return the number of sections.
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
// Return the number of rows in the section.
return [jsonarray count];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = #"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
}
NSLog(#"1");
NSLog(#"%#",jsonarray);
cell.textLabel.text=[jsonarray objectAtIndex:indexPath.row];
NSLog(#"2");
return cell;
}
-(void)dealloc
{
[super dealloc];
[jsonarray release];
[jsondata release];
[jsonurl release];
}
#end
i've inserted tableviewcontroller by adding file with UITableViewController..will that be a problem..Help please..
Your JSON contains an array of dictionaries, so you're setting the text in your table view cell to an dictionary which cannot work since a string is expected. This actually should crash.
To solve that set your text to the category property of that dictionary:
cell.textLabel.text=[[jsonarray objectAtIndex:indexPath.row] valueForKey: #"category"];
besides this there are other things wrong with your code: [super dealloc] needs to be the last thing you call in your dealloc method. And you really should be using asynchronous networking code, blocking the main thread with networking is not acceptable.

Signal SIGABRT in Xcode

I have table in which i would like to tap on the cell and it takes me to another table.
I got this error while running in Xcode 4.3.2 :
return UIApplicationMain(argc, argv, nil, NSStringFromClass([RanchForecastTouchAppDelegate class]));
Thread 1: Signal SIGABRT
I saw alot of answer related this error in this forum but it didn't work, it's the reason that I asked question again.
My code is:
CreateViewController.h
#import <UIKit/UIKit.h>
#interface CreateViewController : UIViewController <
UITableViewDataSource, UITableViewDelegate>
{
NSArray *tableData;
}
#property (nonatomic, retain) NSArray *tableData;
#end
CreateViewController.m
#import "CreateViewController.h"
#implementation CreateViewController
#synthesize tableData;
#pragma mark - View lifecycle
- (void)viewDidLoad
{
tableData = [[NSArray alloc] initWithObjects:#"Johan", #"Paul",#"George",#"Ringo", nil];
[super viewDidLoad];
// Do any additional setup after loading the view.
}
#pragma mark - TableView Data Source methods
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section;
{
return [tableData count];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath;
{
UITableViewCell *cell = nil;
cell = [tableView dequeueReusableCellWithIdentifier:#"MyCell"];
if(cell == nil)
{
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:#"MyCell"];
}
cell.textLabel.text = [tableData objectAtIndex:indexPath.row];
return cell;
}
#end
Error message on console:
[UIViewController tableView:numberOfRowsInSection:]: unrecognized selector sent to instance 0x68ab4d0
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIViewController tableView:numberOfRowsInSection:]: unrecognized selector sent to instance 0x68ab4d0'
Edit:
#import "RanchForecastTouchViewController.h"
#interface RanchForecastTouchViewController ()
#end
#implementation RanchForecastTouchViewController
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
}
- (void)viewDidUnload
{
[super viewDidUnload];
// Release any retained subviews of the main view.
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);
} else {
return YES;
}
}
#end
RanchForecastTouchViewController.h
#import <UIKit/UIKit.h>
#interface RanchForecastTouchViewController : UIViewController
#end
check your user interface connection, It would be for some wrong connections!
you added semicolons at the end of the line
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section;
{ ...
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath;
{....
}
just remove them

NSMutableArray doesn't get populated on view's first appearance

I'm using the Dropbox SDK to fill an array filePaths.
However the array is only filled the second time I open the corresponding view. When I open the view for the first time, the array is empty.
Does anyone know why this is?
Thanks in advance!
// DropboxFileViewController.m
#import "DropboxFileViewController.h"
#import "DropboxViewController.h"
#import "DropboxSDK.h"
#import <stdlib.h>
#interface DropboxFileViewController () <DBRestClientDelegate>
#property (nonatomic, readonly) DBRestClient* restClient;
#end
#implementation DropboxFileViewController
#synthesize dropboxFileView;
#synthesize filePaths;
- (void)restClient:(DBRestClient*)client loadedMetadata:(DBMetadata*)metadata {
//NSArray* validExtensions = [NSArray arrayWithObjects:#"pdf", #"docx", #"doc", nil];
NSMutableArray* newDropboxFilePaths = [NSMutableArray new];
for (DBMetadata* child in metadata.contents) {
//NSString* extension = [[child.path pathExtension] lowercaseString];
//if (!child.isDirectory && [validExtensions indexOfObject:extension] != NSNotFound) {
[newDropboxFilePaths addObject:child.path];
//}
}
[filePaths release];
filePaths = newDropboxFilePaths;
}
/*- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization.
}
return self;
}*/
#pragma mark -
#pragma mark Initialization
/*
- (id)initWithStyle:(UITableViewStyle)style {
// Override initWithStyle: if you create the controller programmatically and want to perform customization that is not appropriate for viewDidLoad.
self = [super initWithStyle:style];
if (self) {
// Custom initialization.
}
return self;
}
*/
#pragma mark -
#pragma mark View lifecycle
- (void)viewDidLoad {
[super viewDidLoad];
// Uncomment the following line to display an Edit button in the navigation bar for this view controller.
// self.navigationItem.rightBarButtonItem = self.editButtonItem;
}
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
[self.restClient loadMetadata:#"/"];
}
- (DBRestClient*)restClient {
if (restClient == nil) {
restClient = [[DBRestClient alloc] initWithSession:[DBSession sharedSession]];
restClient.delegate = self;
}
return restClient;
}
- (void)viewDidAppear:(BOOL)animated {
[super viewDidAppear:animated];
[dropboxFileView reloadData];
}
/*
- (void)viewWillDisappear:(BOOL)animated {
[super viewWillDisappear:animated];
}
*/
/*
- (void)viewDidDisappear:(BOOL)animated {
[super viewDidDisappear:animated];
}
*/
/*
// Override to allow orientations other than the default portrait orientation.
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
// Return YES for supported orientations.
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
*/
#pragma mark -
#pragma mark Table view data source
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
// Return the number of sections.
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
// Return the number of rows in the section.
return [filePaths count];
//NSLog(#"deze shit wordt geinvoked vriend");
}
// Customize the appearance of table view cells.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = #"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
}
// Configure the cell...
//NSDictionary *dictionary = [listOfItems objectAtIndex:indexPath.section];
NSUInteger row = [indexPath row];
cell.textLabel.text = [filePaths objectAtIndex:row];
return cell;
}
/*
// Override to support conditional editing of the table view.
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath {
// Return NO if you do not want the specified item to be editable.
return YES;
}
*/
/*
// Override to support editing the table view.
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
if (editingStyle == UITableViewCellEditingStyleDelete) {
// Delete the row from the data source.
[tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade];
}
else if (editingStyle == UITableViewCellEditingStyleInsert) {
// Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view.
}
}
*/
/*
// Override to support rearranging the table view.
- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath {
}
*/
/*
// Override to support conditional rearranging of the table view.
- (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath {
// Return NO if you do not want the item to be re-orderable.
return YES;
}
*/
#pragma mark -
#pragma mark Table view delegate
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
// Navigation logic may go here. Create and push another view controller.
/*
<#DetailViewController#> *detailViewController = [[<#DetailViewController#> alloc] initWithNibName:#"<#Nib name#>" bundle:nil];
// ...
// Pass the selected object to the new view controller.
[self.navigationController pushViewController:detailViewController animated:YES];
[detailViewController release];
*/
}
#pragma mark -
#pragma mark Memory management
- (void)didReceiveMemoryWarning {
// Releases the view if it doesn't have a superview.
[super didReceiveMemoryWarning];
// Relinquish ownership any cached data, images, etc. that aren't in use.
}
- (void)viewDidUnload {
// Relinquish ownership of anything that can be recreated in viewDidLoad or on demand.
// For example: self.myOutlet = nil;
}
- (void)dealloc {
[super dealloc];
}
#end
your observation might be wrong.
I guess DBRestClient does its work in another thread. And shortly after you've left viewWillAppear the tableview gets its data. And at this time the DBRestClient isn't finished.
To fix this simply reload the tableview when you get the data
Append [dropboxFileView reloadData]; to - (void)restClient:(DBRestClient*)client loadedMetadata:(DBMetadata*)metadata