Advertise Books Events Forum News Social Networking Support Us

sdkIQ for iPhone
($4.99)

Shape Up
($0.99)

Your First iPhone App
($1.99)

iVidCam Free
(free)

Kid Art
($0.99)

iPUBQUIZ
(£1.19)

ArtStudio
($3.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum

View Single Post
Old 08-29-2008, 09:54 AM   #1 (permalink)
bhil
New Member
 
Join Date: Aug 2008
Posts: 17
Question Problem Creating a TableView in a TabBar App

Hey everyone, I'm at my wits end with this, and hopefully someone can help. I think this must be an Interface Builder bug, but let me know what you think and if you know a way around it.

Whenever I try to create a View in a tab bar based application that contains a Table View, I end up with the following exception when trying to switch to the tab:
'NSUnknownKeyException', reason: '[<UIViewController 0x451100> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key tableView.'

If I create a simple view based application with a Table View, everything works fine. I'll show the steps I go through below for both cases and hopefully someone can see what I'm doing wrong/differently that I don't realize.

Case 1:
  1. In Xcode go to File...New Project...View Based Application, and name it Demo.
  2. Open DemoViewController.h and add the following code in the appropriate two locations:
    Code:
    IBOutlet UITableView *tableView;
    @property (nonamtomic,retain) UITableView *tableView;
  3. Open DemoViewController.m and add the following line:
    Code:
    @synthesize tableView;
  4. Open DemoViewController.xib
    • Drag a Table View into the view
    • Right click on the table view.
    • Drag from the dot beside New Referencing Outlet to File's Owner and select tableView.
  5. Save everything and Build and Go. The table view shows up fine in the simulator.

Case 2:
  1. In Xcode go to File... New Project ... Tab Bar Application and name it Demo2.
  2. Right click on Classes...Add...New File...UIViewController subclass and name it SecondViewController.
  3. Open SecondViewController.h and add the following code in the appropriate two locations:
    Code:
    IBOutlet UITableView *tableView;
    @property (nonamtomic,retain) UITableView *tableView;
  4. Open SecondViewController.m and add the following line:
    Code:
    @synthesize tableView;
  5. Open SecondView.xib
    • Remove the label that says Second View
    • Select File's Owner and in the Inspector Identity tab change the Class to SecondViewController.
    • Drag a Table View into the view
    • Right click on the table view.
    • Drag from the dot beside New Referencing Outlet to File's Owner and select tableView.
  6. Save everything and Build and Go.
The first view shows up fine. Click on the Second tab. The simulator crashes with the following stack trace on the console:

[Session started at 2008-08-29 08:10:45 -0600.]
Loading program into debugger…
Warning - No location found for "DatabaseSearchViewController.m:53"
GNU gdb 6.3.50-20050815 (Apple version gdb-960) (Sun May 18 18:38:33 UTC 2008)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "i386-apple-darwin".warning: Unable to read symbols for "/System/Library/Frameworks/UIKit.framework/UIKit" (file not found).
warning: Unable to read symbols from "UIKit" (not yet mapped into memory).
Program loaded.
sharedlibrary apply-load-rules all
Attaching to program: `/Users/myusername/Library/Application Support/iPhone Simulator/User/Applications/662568B1-441A-4705-9003-0BF0D68D45C1/Demo2.app/Demo2', process 64174.
2008-08-29 08:10:50.011 Demo2[64174:20b] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<UIViewController 0x451100> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key tableView.'
2008-08-29 08:10:50.012 Demo2[64174:20b] Stack: (
2535018827,
2522071291,
2535017585,
2490358200,
2490356766,
2490899809,
818073927,
2534972549,
818068629,
818076920,
816648466,
816648934,
816688492,
816684429,
816177758,
818091155,
816177758,
816558114,
816559338,
816558227,
816177758,
816558114,
816559338,
816556080,

816274443,
816209415,
816206378,
829003042,
829012108,
2534520341,
2534522104,
829005112,
829005309,
816175835,
816221412,
9864,
9718
)
bhil is offline   Reply With Quote
 
Enter the iPhone App Challenge!  Win $500!
» Advertisements
» Stats
Members: 24,267
Threads: 39,062
Posts: 171,292
Top Poster: smasher (2,575)
Welcome to our newest member, nvrendingsoft
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 08:54 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.