Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

iOS

blog reader app

Hey all I'm on the second stage of the blog reader app project and i have been having a problem when i run the simulator..... all i get is a blank black screen.... here is my code for the tableViewController

#import "tableViewController.h"

@interface tableViewController ()

@end

@implementation tableViewController

- (id)initWithStyle:(UITableViewStyle)style
{
    self = [super initWithStyle:style];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];

  self.titles = [NSArray arrayWithObjects: @"the missing widget",
                                    @"Get started with iOS dev",
                                    @"An interview with Shay Howe",
                                    @"Treehouse friends: Paul Irish",
                                    @"Getting a job in web design",
                                    @"Treehouse show Episode 13",
                 nil];
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

#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 [self.titles count];
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *CellIdentifier = @"Cell";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
    cell.textLabel.text = [self.titles objectAtIndex:indexPath.row];

    return cell;
}

let me know if you need to see other code. im worried i just didnt link the storyboard or something.....

6 Answers

Amit Bijlani
STAFF
Amit Bijlani
Treehouse Guest Teacher

Make sure your project settings have the storyboard selected where it says Main Interface. If not, use the drop-down to select it.

Brayden Kness
Brayden Kness
12,492 Points

Go into your appDelegate.h and delete all of the code in didFinishLaunchingWithOptions except for return YES;

it should look like...

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    return YES;
}

not like...

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
    // Override point for customization after application launch.
    self.window.backgroundColor = [UIColor whiteColor];
    [self.window makeKeyAndVisible];
    return YES;
}

this is the default of an empty application and it overrides a storyborad

thank you for the help Kirk Kness i did what you said but now i have a whole other issue... ill try to explain a little but i think its better is i just link to a sceen shot of what x-code is telling me.

it says under thread1

0x1eae952: jae 0x1eae962 ; __pthread_kill + 26

i have no idea what that means. if that doesnt make sense to you either here is a sceen shot of what my xcade looks like after i try and run the simulator.

http://www.flickr.com/photos/111027366@N05/11289882933/

let me know if that helps or if you need more info.

thanks again for the help.

Brayden Kness
Brayden Kness
12,492 Points

So basically your app is crashing. For what reason, I'm not entirely sure. First, you should check and make sure there aren't any typos. Then look at the console out log (if you could screenshot the log as well that would be helpful). Lastly, expand the threads that are shown on the left hand side by sliding the slider in the bottom left hand corner.

Brayden Kness
Brayden Kness
12,492 Points

Actually first you should add an exception breakpoint if you don't know how Amit Bijlani has a great debugging video in the crystal ball project.

Thanks again for the help Kirk Kness and Amit Bijlani. i set an exception breakpoint but i am kinda lost with all the data that i am getting now. i put up some more screen shots of what my xcode looks like

http://www.flickr.com/photos/111027366@N05/

i think there are problems in my json implementation so here is the code

    NSDictionary *dataDictionary = [NSJSONSerialization JSONObjectWithData:jsonData options:0 error:&error];

other than that i dont really know how to go about fixing the screen issue casue when i expand on the data that it gives me alot of stuff that im not too sure about. hopefully the screen shots help, casue i am quite lost

Brayden Kness
Brayden Kness
12,492 Points

Check your blogUrl and make sure that works and there aren't any typos

OH MAN!! so close i can feel it!! i got the blog url sorted out and now it is showing me things and the blog reader is running on the screen!! whooooho00! but when i press one of the articles it crashes again :( haha the problem seems to be coming from main.m this time.

 @autoreleasepool {
        return UIApplicationMain(argc, argv, nil, NSStringFromClass([xyzAppDelegate class]));

i went through and watched the debug video again to see if i could make sense of it but cant seem to find anything..... hmmmm im going to keep looking for typos and see if i can come up with anything.

Brayden Kness
Brayden Kness
12,492 Points

Whenever it crashes and shows main.m that just means that there isn't anything that the compiler can find wrong with your app but it doesn't that there is something wrong with main.m. But yeah keep looking for errors and also you could send your project to brayk2@gmail.com

Brayden Kness
Brayden Kness
12,492 Points

Also make sure where you grab the URL from the dictionary that you don't have any typos

im also getting this message in the output

Application windows are expected to have a root view controller at the end of application launch

just in case that means anything to anyone....

Amit Bijlani
STAFF
Amit Bijlani
Treehouse Guest Teacher

You have to make sure that your Storyboard is setup as an initial scene.

Thanks for the help!

i checked it out and it seems to be all in order, the initial scene box in my table view controller is defiantly checked....

any other ideas of what it could be? did i just skip over a small step? when i launch the app it says build successful but the output keeps saying

2013-12-05 17:30:05.652 anotheReader[21791:70b] Application windows are expected to have a root view controller at the end of application launch.....

yes i have that set right too....

im thinking about just starting it over to see if that helps.