TableView is Empty

Discussion in 'iOS Programming' started by RagingGoat, Oct 18, 2012.

  1. RagingGoat macrumors 6502

    Joined:
    Jun 21, 2010
    #1
    I have an app that shows an RSS feed in a table view and then you can tap on an article and it goes to a web view. It worked fine on its own so I've incorporated it into another project. The new project has a home screen with a bunch of buttons and some of them are supposed to show different RSS feeds. I have the buttons working and going to the table view for their respective feeds but none of the RSS feed articles appear.
     
  2. dejo Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #2
    We're gonna need more info than that if we're to help you. You say, "none of the RSS feed articles appear". Does something else appear instead? Are you getting any run- or compile-time errors or warnings? We're also going to want to see the code that presents the new view, retrieves the RSS feed, and populates the table, and the context in which these things occur.
     
  3. RagingGoat thread starter macrumors 6502

    Joined:
    Jun 21, 2010
    #3
    Nothing appears in the table view. I had essentially the same code working on its own in a different project but now that I have a different "Home" screen and tell the buttons what to do, the table view is empty. I have attached text files with the code for my classes. I have a couple of other classes just like ListViewController. The only difference between them is that they look at different RSS feeds.
     

    Attached Files:

  4. RagingGoat thread starter macrumors 6502

    Joined:
    Jun 21, 2010
    #4
    More class files
     

    Attached Files:

  5. RagingGoat thread starter macrumors 6502

    Joined:
    Jun 21, 2010
    #5
    The last two.
     

    Attached Files:

  6. dejo Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #6
    I think you'll get a better response if you include your code snippets inline, using
    Code:
     tags.
    
    [B]P.S.[/B]
    What debugging have you done? If any, what have you learned from it?
     
  7. RagingGoat thread starter macrumors 6502

    Joined:
    Jun 21, 2010
    #7
    Code:
    //
    //  KFBAppDelegate.h
    //  KFBNewsroom
    //
    //  Created by KFB on 10/15/12.
    //  Copyright (c) 2012 com.kfb. All rights reserved.
    //
    
    #import <UIKit/UIKit.h>
    
    @class KFBViewController;
    
    @interface KFBAppDelegate : UIResponder <UIApplicationDelegate>
    
    @property (strong, nonatomic) UIWindow *window;
    
    @property (strong, nonatomic) KFBViewController *viewController;
    
    @end
    
    Code:
    //
    //  KFBAppDelegate.m
    //  KFBNewsroom
    //
    //  Created by KFB on 10/15/12.
    //  Copyright (c) 2012 com.kfb. All rights reserved.
    //
    
    #import "KFBAppDelegate.h"
    #import "KFBViewController.h"
    #import "ListViewController.h"
    #import "WebViewController.h"
    #import "ActionAlertsViewController.h"
    #import "MarketUpdatesViewController.h"
    
    @implementation KFBAppDelegate
    
    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
    {
        self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
        // Override point for customization after application launch.
        self.viewController = [[KFBViewController alloc] initWithNibName:@"KFBViewController" bundle:nil];
        ListViewController *lvc = [[ListViewController alloc]initWithStyle:UITableViewStylePlain];
        WebViewController *wvc = [[WebViewController alloc]init];
        [lvc setWebViewController:wvc];
        ActionAlertsViewController *avc = [[ActionAlertsViewController alloc]initWithStyle:UITableViewStylePlain];
        [avc setWebViewController:wvc];
        MarketUpdatesViewController *mvc = [[MarketUpdatesViewController alloc]initWithStyle:UITableViewStylePlain];
        [mvc setWebViewController:wvc];
        self.window.rootViewController = self.viewController;
        self.window.backgroundColor = [UIColor whiteColor];
        [self.window makeKeyAndVisible];
        return YES;
    }
    
    - (void)applicationWillResignActive:(UIApplication *)application
    {
        // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
        // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
    }
    
    - (void)applicationDidEnterBackground:(UIApplication *)application
    {
        // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 
        // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
    }
    
    - (void)applicationWillEnterForeground:(UIApplication *)application
    {
        // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
    }
    
    - (void)applicationDidBecomeActive:(UIApplication *)application
    {
        // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
    }
    
    - (void)applicationWillTerminate:(UIApplication *)application
    {
        // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
    }
    
    @end
    
    Code:
    //
    //  KFBViewController.h
    //  KFBNewsroom
    //
    //  Created by KFB on 10/15/12.
    //  Copyright (c) 2012 com.kfb. All rights reserved.
    //
    
    #import <UIKit/UIKit.h>
    
    @interface KFBViewController : UIViewController
    {
        
    }
    
    - (IBAction) gotoSecondView;
    - (IBAction) gotoPublicAffairs;
    - (IBAction) gotoActionAlerts;
    - (IBAction) gotoMarketUpdates;
    - (IBAction) gotoMemberBenefits;
    
    
    
    
    @end
    
    Code:
    //
    //  KFBViewController.m
    //  KFBNewsroom
    //
    //  Created by KFB on 10/15/12.
    //  Copyright (c) 2012 com.kfb. All rights reserved.
    //
    
    #import "KFBViewController.h"
    #import "KFBYouTubeView.h"
    #import "ListViewController.h"
    #import "ActionAlertsViewController.h"
    #import "MarketUpdatesViewController.h"
    #import "MemberBenefits.h"
    
    @interface KFBViewController ()
    
    @end
    
    @implementation KFBViewController
    
    - (IBAction)gotoSecondView
    {
        // The following lines will load the second view
        KFBYouTubeView *youtubeView = [[KFBYouTubeView alloc] initWithNibName:nil bundle:nil];
        youtubeView.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
        // [self presentModalViewController:youtubeView animated:YES];
        [self presentViewController:youtubeView animated:YES completion:nil];
    }
    
    - (IBAction)gotoPublicAffairs
    {
        ListViewController *publicAffairs = [[ListViewController alloc] initWithNibName:nil bundle:nil];
        publicAffairs.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
        // [self presentModalViewController:publicAffairs animated:YES];
        [self presentViewController:publicAffairs animated:YES completion:nil];
    }
    
    - (IBAction)gotoActionAlerts
    {
        ActionAlertsViewController *actionAlerts = [[ActionAlertsViewController alloc] initWithNibName:nil bundle:nil];
        actionAlerts.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
        // [self presentModalViewController:actionAlerts animated:YES];
        [self presentViewController:actionAlerts animated:YES completion:nil];
    }
    
    - (IBAction)gotoMarketUpdates
    {
        MarketUpdatesViewController *marketUpdates = [[MarketUpdatesViewController alloc] initWithNibName:nil bundle:nil];
        marketUpdates.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
        // [self presentModalViewController:marketUpdates animated:YES];
        [self presentViewController:marketUpdates animated:YES completion:nil];
    }
    
    - (IBAction)gotoMemberBenefits
    {
        MemberBenefits *memberBenefits = [[MemberBenefits alloc] initWithNibName:nil bundle:nil];
        memberBenefits.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
        // [self presentModalViewController:memberBenefits animated:YES];
        [self presentViewController:memberBenefits animated:YES completion:nil];
    }
    
    
    - (void)viewDidLoad
    {
        [super viewDidLoad];
    	// Do any additional setup after loading the view, typically from a nib.
    }
    
    - (void)didReceiveMemoryWarning
    {
        [super didReceiveMemoryWarning];
        // Dispose of any resources that can be recreated.
    }
    
    @end
    


    ----------

    Code:
    //
    //  ListViewController.h
    //  Nerdfeed
    //
    //  Created by KFB on 10/16/12.
    //  Copyright (c) 2012 com.kfb. All rights reserved.
    //
    
    #import <Foundation/Foundation.h>
    
    // @interface ListViewController : NSObject
    
    // a forward declaration; we'll import the header in the .m
    @class RSSChannel;
    @class WebViewController;
    
    @interface ListViewController : UITableViewController
    <NSXMLParserDelegate>
    {
        NSURLConnection *connection;
        NSMutableData *xmlData;
        RSSChannel *channel;
    }
    @property (nonatomic, strong)WebViewController *webViewController;
    
    - (void)fetchEntries;
    
    
    @end
    
    Code:
    //
    //  ListViewController.m
    //  Nerdfeed
    //
    //  Created by KFB on 10/16/12.
    //  Copyright (c) 2012 com.kfb. All rights reserved.
    //
    
    #import "ListViewController.h"
    #import "RSSChannel.h"
    #import "RSSItem.h"
    #import "WebViewController.h"
    
    @implementation ListViewController
    @synthesize webViewController;
    
    - (void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName attributes:(NSDictionary *)attributeDict
    {
        NSLog(@"%@ found a %@ element", self, elementName);
        if ([elementName isEqual:@"channel"])
        {
            // If the parser saw a channel, create new instance, store in our ivar
            channel = [[RSSChannel alloc]init];
            
            // Give the channel object a pointer back to ourselves for later
            [channel setParentParserDelegate:self];
            
            // Set the parser's delegate to the channel object
            [parser setDelegate:channel];
        }
    }
    
    - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
    {
        // return 0;
        
        return [[channel items]count];
    }
    
    - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
    {
        // return nil;
        
        UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"UITableViewCell"];
        if (cell == nil)
        {
            cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"UITableViewCell"];
        }
        RSSItem *item = [[channel items]objectAtIndex:[indexPath row]];
        [[cell textLabel]setText:[item title]];
        
        return cell;
    }
    
    - (void)fetchEntries
    {
        // Create a new data container for the stuff that comes back from the service
        xmlData = [[NSMutableData alloc]init];
        
        // Construct a URL that will ask the service for what you want -
        // note we can concatenate literal strings together on multiple lines in this way - this results in a single NSString instance
        NSURL *url = [NSURL URLWithString:@"http://kyfbnewsroom.com/category/public-affairs/feed"];
        
        // Put that URL into an NSURLRequest
        NSURLRequest *req = [NSURLRequest requestWithURL:url];
        
        // Create a connection that will exchange this request for data from the URL
        connection = [[NSURLConnection alloc]initWithRequest:req delegate:self startImmediately:YES];
    }
    
    - (id)initWithStyle:(UITableViewStyle)style
    {
        self = [super initWithStyle:style];
        
        if (self)
        {
            [self fetchEntries];
        }
        
        return self;
    }
    
    // This method will be called several times as the data arrives
    - (void)connection:(NSURLConnection *)conn didReceiveData:(NSData *)data
    {
        // Add the incoming chunk of data to the container we are keeping
        // The data always comes in the correct order
        [xmlData appendData:data];
    }
    
    - (void)connectionDidFinishLoading:(NSURLConnection *)conn
    {
        /* We are just checking to make sure we are getting the XML
         NSString *xmlCheck = [[NSString alloc]initWithData:xmlData encoding:NSUTF8StringEncoding];
         NSLog(@"xmlCheck = %@", xmlCheck);*/
        
        // Create the parser object with the data received from the web service
        NSXMLParser *parser = [[NSXMLParser alloc]initWithData:xmlData];
        
        // Give it a delegate - ignore the warning here for now
        [parser setDelegate:self];
        
        //Tell it to start parsing - the document will be parsed and the delegate of NSXMLParser will get all of its delegate messages sent to it before this line finishes execution - it is blocking
        [parser parse];
        
        // Get rid of the XML data as we no longer need it
        xmlData = nil;
        
        // Reload the table.. for now, the table will be empty
        [[self tableView]reloadData];
        
        NSLog(@"%@\n %@\n %@\n", channel, [channel title], [channel infoString]);
    }
    
    - (void)connection:(NSURLConnection *)conn didFailWithError:(NSError *)error
    {
        // Release the connection object, we're done with it
        connection = nil;
        
        // Release the xmlData object, we're done with it
        xmlData = nil;
        
        // Grab the description of the error object passed to us
        NSString *errorString = [NSString stringWithFormat:@"Fetch failed: %@", [error localizedDescription]];
        
        // Create and show an alert view with this error displayed
        UIAlertView *av = [[UIAlertView alloc]initWithTitle:@"Error" message:errorString delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
        [av show];
    }
    
    - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
    {
        // Push the web view controller onto the navigation stack - this implicitly creates the web view controller's view the first time through
        [[self navigationController]pushViewController:webViewController animated:YES];
        
        // Grab the selected item
        RSSItem *entry = [[channel items]objectAtIndex:[indexPath row]];
        
        // Construct a URL with the link string of the item
        NSURL *url = [NSURL URLWithString:[entry link]];
        
        // Construct a request object with that URL
        NSURLRequest *req = [NSURLRequest requestWithURL:url];
        
        // Load the request into the web view
        [[webViewController webView]loadRequest:req];
        
        // Set the title of the web view controller's navigation item
        [[webViewController navigationItem]setTitle:[entry title]];
    }
    
    
    
    @end
    
    Code:
    //
    //  RSSChannel.h
    //  Nerdfeed
    //
    //  Created by KFB on 10/16/12.
    //  Copyright (c) 2012 com.kfb. All rights reserved.
    //
    
    #import <Foundation/Foundation.h>
    
    @interface RSSChannel : NSObject <NSXMLParserDelegate>
    {
        NSMutableString *currentString;
    }
    
    @property (nonatomic, weak) id parentParserDelegate;
    
    @property (nonatomic, strong) NSString *title;
    @property (nonatomic, strong) NSString *infoString;
    @property (nonatomic, readonly, strong) NSMutableArray *items;
    
    @end
    
    Code:
    //
    //  RSSChannel.m
    //  Nerdfeed
    //
    //  Created by KFB on 10/16/12.
    //  Copyright (c) 2012 com.kfb. All rights reserved.
    //
    
    #import "RSSChannel.h"
    #import "RSSItem.h"
    
    @implementation RSSChannel
    @synthesize items, title, infoString, parentParserDelegate;
    
    - (id)init
    {
        self = [super init];
        
        if (self)
        {
            // Create the container for the RSSItems this channel has; we'll create the RSSItem class shortly.
            items = [[NSMutableArray alloc]init];
        }
        
        return self;
    }
    
    - (void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName attributes:(NSDictionary *)attributeDict
    {
        NSLog(@"\t%@ found a %@ element", self, elementName);
        
        if ([elementName isEqual:@"title"])
        {
            currentString = [[NSMutableString alloc]init];
            [self setTitle:currentString];
        }
        else if ([elementName isEqual:@"description"])
        {
            currentString = [[NSMutableString alloc]init];
            [self setInfoString:currentString];
        }
        else if ([elementName isEqual:@"item"])
        {
            // When we find an item, create an instance of RSSItem
            RSSItem *entry = [[RSSItem alloc]init];
            
            // Set up its parent as ourselves so we can regain control of the parser
            [entry setParentParserDelegate:self];
            
            // Turn the parser to the RSSItem
            [parser setDelegate:entry];
            
            // Add the item to our array and release our hold on it
            [items addObject:entry];
        }
    }
    
    - (void)parser:(NSXMLParser *)parser foundCharacters:(NSString *)str
    {
        [currentString appendString:str];
    }
    
    - (void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName
    {
        // If we were in an element that we were collecting the string for, this appropriately releases our hold on it and the permanent ivar keeps ownership of it.  If we weren't parsing such an element, currentString is nill already.
        currentString = nil;
        
        // If the element that ended was the channel, give up control to who gave us control in the first place
        if ([elementName isEqual:@"channel"])
        {
            [parser setDelegate:parentParserDelegate];
        }
    }
    
    @end
    
    Code:
    //
    //  RSSItem.h
    //  Nerdfeed
    //
    //  Created by KFB on 10/16/12.
    //  Copyright (c) 2012 com.kfb. All rights reserved.
    //
    
    #import <Foundation/Foundation.h>
    
    @interface RSSItem : NSObject <NSXMLParserDelegate>
    {
        NSMutableString *currentString;
    }
    
    @property (nonatomic, weak) id parentParserDelegate;
    
    @property (nonatomic, strong) NSString *title;
    @property (nonatomic, strong) NSString *link;
    
    @end
    
    Code:
    //
    //  RSSItem.m
    //  Nerdfeed
    //
    //  Created by KFB on 10/16/12.
    //  Copyright (c) 2012 com.kfb. All rights reserved.
    //
    
    #import "RSSItem.h"
    
    @implementation RSSItem
    
    @synthesize title, link, parentParserDelegate;
    
    - (void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName attributes:(NSDictionary *)attributeDict
    {
        NSLog(@"\t\t%@ found a %@ element", self, elementName);
        
        if ([elementName isEqual:@"title"])
        {
            currentString = [[NSMutableString alloc]init];
            [self setTitle:currentString];
        }
        else if ([elementName isEqual:@"link"])
        {
            currentString = [[NSMutableString alloc]init];
            [self setLink:currentString];
        }
    }
    
    - (void)parser:(NSXMLParser *)parser foundCharacters:(NSString *)str
    {
        [currentString appendString:str];
    }
    
    - (void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName
    {
        currentString = nil;
        
        if ([elementName isEqual:@"item"])
        {
            [parser setDelegate:parentParserDelegate];
        }
    }
    
    @end
    
    Code:
    //
    //  WebViewController.h
    //  Nerdfeed
    //
    //  Created by KFB on 10/16/12.
    //  Copyright (c) 2012 com.kfb. All rights reserved.
    //
    
    #import <Foundation/Foundation.h>
    
    // @interface WebViewController : NSObject
    @interface WebViewController : UIViewController
    
    @property (nonatomic, readonly)UIWebView *webView;
    
    @end
    
    
    Code:
    //
    //  WebViewController.m
    //  Nerdfeed
    //
    //  Created by KFB on 10/16/12.
    //  Copyright (c) 2012 com.kfb. All rights reserved.
    //
    
    #import "WebViewController.h"
    
    @implementation WebViewController
    
    - (void)loadView
    {
        // Create an instance of UIWebView as large as the screen
        CGRect screenFrame = [[UIScreen mainScreen]applicationFrame];
        UIWebView *wv = [[UIWebView alloc]initWithFrame:screenFrame];
        // Tell web view to scale web content to fit within bounds of webview
        [wv setScalesPageToFit:YES];
        
        [self setView:wv];
    }
    
    - (UIWebView *)webView
    {
        return (UIWebView *)[self view];
    }
    
    @end
    
     
  8. TheWatchfulOne macrumors 6502

    Joined:
    Jun 19, 2009
    #8
    In your ListViewController, I don't see an implementation for tableView:numberOfSections.

    Maybe it's the cause of your problem or maybe it's not. But I was thinking maybe you need to implement that method and return a value of at least 1.

    Also, can you confirm that your data array has objects in it? I would look at that.
     
  9. chown33, Oct 19, 2012
    Last edited by a moderator: Nov 5, 2012

    chown33 macrumors 604

    Joined:
    Aug 9, 2009
    #9
    As asked yesterday by dejo:
    What debugging have you done? If any, what have you learned from it?


    I would add the following:

    Are you using the debugger at all?

    You have some NSLog's in your code, so what do they show? Post the actual output.

    If you had "essentially the same code" working before, exactly what did you change? Do you know how to do differential compares between source files?
     
  10. RagingGoat thread starter macrumors 6502

    Joined:
    Jun 21, 2010
    #10
    The only thing that changed from when it was working correctly before is that I added all of the RSS and web view code to another project with a different root view. I'm not really sure how to change the table views so that they will show correctly in this new project.
     
  11. RagingGoat thread starter macrumors 6502

    Joined:
    Jun 21, 2010
    #11
    Here is the output.
     

    Attached Files:

  12. dejo Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #12
    I think you should put some breakpoints (or NSLogs) in your code and confirm that the code you think is executing at the times you think it should be executing, actually is. Especially, fetchEntries.
     
  13. RagingGoat thread starter macrumors 6502

    Joined:
    Jun 21, 2010
    #13
    The RSS code was working correctly on it's own. The only thing that has changed is that I've taken that code and put it into a new project that has a different root view controller (a home screen with buttons for different feeds) The old project that I took the code from went straight to the table view when the app started. Could the problem have something to do with having a different root view controller and then tapping a button to go to the RSS feed table view? Perhaps I don't have that part set up correctly?
     
  14. dejo Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #14
    Possibly. That is one of the purposes of debugging: to confirm code is doing what you think it's doing. I find that stepping through code will often expose inaccuracies in my suppositions.
     
  15. RagingGoat thread starter macrumors 6502

    Joined:
    Jun 21, 2010
    #15
    I've had someone suggest adding
    UITableViewDelegate, UITableViewDataSource to ListViewController.h and adding
    Code:
    -(void)viewDidLoad 
    {
         [super viewDidLoad];
         [tableView setDelegate: self];
         [tableView setDataSource: self];
    }
    
    to the .m file.

    I get this error though:
    Unknown receiver 'tableView', did you mean UITableView?

    Is that because I'm using UITableViewController instead of UITableView?
     
  16. dejo Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #16
    I'd suggest not trying random solutions to a fairly undefined problem. Take the time to properly diagnose the specific problem. Then, once you know that, you will be better equipped to try to determine a much more suitable solution. Often, I find that by narrowing down the problem, it becomes obvious what the solution should be ("Aha, my code is not even calling that method that I thought should be called.")

    Have you done the debugging (breakpoints, NSLogs) I suggested yet, especially in regards to fetchEntries?
     
  17. RagingGoat thread starter macrumors 6502

    Joined:
    Jun 21, 2010
    #17
    I have not done the break points yet. I just thought I'd mention that suggestion I received.
     
  18. RagingGoat thread starter macrumors 6502

    Joined:
    Jun 21, 2010
    #18
    And I know the fetchEntries method works because the RSS feed shows up in the table view when I run it by itself in another project. Before I added it to this project, the table view showed the articles from the RSS feed and when I tapped on one it would go to the web view. So, I know that code works.
     
  19. nickculbertson macrumors regular

    nickculbertson

    Joined:
    Nov 19, 2010
    Location:
    Nashville, TN
    #19
    My guess is that you don't have your delegate methods connected to the files owner in IB.

    Nick
     
  20. RagingGoat thread starter macrumors 6502

    Joined:
    Jun 21, 2010
    #20
    How can I connect the delegate methods programmatically without the IB? I don't have a nib file.
     
  21. nickculbertson macrumors regular

    nickculbertson

    Joined:
    Nov 19, 2010
    Location:
    Nashville, TN
    #21
    Well for one thing you need this in your header.

    Code:
    UIViewController <UITableViewDelegate>
    
    Before you start piling on new methods, I'd have another look at your working project version of the code. You must have left something out.
     
  22. RagingGoat thread starter macrumors 6502

    Joined:
    Jun 21, 2010
    #22
    I've added that to my header and gone back to the working project.
     
  23. dejo Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #23
    You know the code works. Fine. But have you confirmed that it is being called when you think it is being called. I have a suspicion about your issue but it's better if you discover the cause yourself (because when you do, it'll be more personal and you'll remember the reason more readily, hopefully) than if I just tell you what the issue is.
     
  24. RagingGoat thread starter macrumors 6502

    Joined:
    Jun 21, 2010
    #24
    Here is what is in the console after running the app. It's not everything in the console but it gives you an idea. I've also attached screenshots. One is after I ran it with a breakpoint at the end of fetchEntries and one of the home screen so you can have a better visual of what I'm trying to do.

    2012-10-24 07:23:34.296 KFBNewsroom[444:c07] <ListViewController: 0x89136f0> found a rss element
    2012-10-24 07:23:34.296 KFBNewsroom[444:c07] <ListViewController:
    2012-10-24 07:23:34.364 KFBNewsroom[444:c07] <RSSItem: 0x713cec0> found a category element
    2012-10-24 07:23:34.365 KFBNewsroom[444:c07] <RSSItem: 0x713cec0> found a category element
    2012-10-24 07:23:34.365 KFBNewsroom[444:c07] <RSSItem: 0x713cec0> found a category element
    2012-10-24 07:23:34.365 KFBNewsroom[444:c07] <RSSItem: 0x713cec0> found a category element
    2012-10-24 07:23:34.365 KFBNewsroom[444:c07] <RSSItem: 0x713cec0> found a category element
    2012-10-24 07:23:34.365 KFBNewsroom[444:c07] <RSSItem: 0x713cec0> found a category element
    2012-10-24 07:23:34.366 KFBNewsroom[444:c07] <RSSItem: 0x713cec0> found a guid element
    2012-10-24 07:23:34.366 KFBNewsroom[444:c07] <RSSItem: 0x713cec0> found a description element
    2012-10-24 07:23:34.366 KFBNewsroom[444:c07] <RSSItem: 0x713cec0> found a content:encoded element
    2012-10-24 07:23:34.366 KFBNewsroom[444:c07] <RSSItem: 0x713cec0> found a wfw:commentRss element
    2012-10-24 07:23:34.366 KFBNewsroom[444:c07] <RSSItem: 0x713cec0> found a slash:comments element
    2012-10-24 07:23:34.367 KFBNewsroom[444:c07] <RSSChannel: 0x891c950>
    Kentucky Farm Bureau » Public Affairs
     
  25. RagingGoat thread starter macrumors 6502

    Joined:
    Jun 21, 2010
    #25
    Here are the screenshots I mentioned in the last post.
     

    Attached Files:

Share This Page