Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
BOOK: Beginning iOS 4 Application Development
This is the forum to discuss the Wrox book Beginning iOS 4 Application Development by Wei-Meng Lee; ISBN: 978-0-470-91802-9
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning iOS 4 Application Development section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 3rd, 2011, 12:53 PM
Authorized User
Points: 92, Level: 1
Points: 92, Level: 1 Points: 92, Level: 1 Points: 92, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: May 2011
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
Default Chapter 8 TableView Blows Up

My effort to enter Chapter 8's "Table View", pages 211-215, results in ka-boom, see below:

GNU gdb 6.3.50-20050815 (Apple version gdb-1518) (Sat Feb 12 02:52:12 UTC 2011)
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 "x86_64-apple-darwin".Attaching to process 441.
2011-07-03 12:31:46.831 TableView[441:207] year=Root
2011-07-03 12:31:46.832 TableView[441:207] row=0
2011-07-03 12:31:46.833 TableView[441:207] -[__NSCFDictionary objectAtIndex:]: unrecognized selector sent to instance 0x601d560
2011-07-03 12:31:46.834 TableView[441:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFDictionary objectAtIndex:]: unrecognized selector sent to instance 0x601d560'
*** Call stack at first throw:
(
0 CoreFoundation 0x00dc15a9 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x00f15313 objc_exception_throw + 44
2 CoreFoundation 0x00dc30bb -[NSObject(NSObject) doesNotRecognizeSelector:] + 187
3 CoreFoundation 0x00d32966 ___forwarding___ + 966
4 CoreFoundation 0x00d32522 _CF_forwarding_prep_0 + 50
5 TableView 0x00002ea4 -[RootViewController tableView:cellForRowAtIndexPath:] + 500
6 UIKit 0x00088b98 -[UITableView(UITableViewInternal) _createPreparedCellForGlobalRow:withIndexPath:] + 634
7 UIKit 0x0007e4cc -[UITableView(UITableViewInternal) _createPreparedCellForGlobalRow:] + 75
8 UIKit 0x000938cc -[UITableView(_UITableViewPrivate) _updateVisibleCellsNow:] + 1561
9 UIKit 0x0008b90c -[UITableView layoutSubviews] + 242
10 QuartzCore 0x016aba5a -[CALayer layoutSublayers] + 181
11 QuartzCore 0x016adddc CALayerLayoutIfNeeded + 220
12 QuartzCore 0x016530b4 _ZN2CA7Context18commit_transactionEPNS_11Transacti onE + 310
13 QuartzCore 0x01654294 _ZN2CA11Transaction6commitEv + 292
14 UIKit 0x000159c9 -[UIApplication _reportAppLaunchFinished] + 39
15 UIKit 0x00015e83 -[UIApplication _runWithURL:payload:launchOrientation:statusBarSty le:statusBarHidden:] + 690
16 UIKit 0x00020617 -[UIApplication handleEvent:withNewEvent:] + 1533
17 UIKit 0x00018abf -[UIApplication sendEvent:] + 71
18 UIKit 0x0001df2e _UIApplicationHandleEvent + 7576
19 GraphicsServices 0x00ffa992 PurpleEventCallback + 1550
20 CoreFoundation 0x00da2944 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FU NCTION__ + 52
21 CoreFoundation 0x00d02cf7 __CFRunLoopDoSource1 + 215
22 CoreFoundation 0x00cfff83 __CFRunLoopRun + 979
23 CoreFoundation 0x00cff840 CFRunLoopRunSpecific + 208
24 CoreFoundation 0x00cff761 CFRunLoopRunInMode + 97
25 UIKit 0x000157d2 -[UIApplication _run] + 623
26 UIKit 0x00021c93 UIApplicationMain + 1160
27 TableView 0x00002489 main + 121
28 TableView 0x00002405 start + 53
)
terminate called after throwing an instance of 'NSException'
sharedlibrary apply-load-rules all
Current language: auto; currently objective-c
(gdb)


I've downloaded the same project from the website and it runs fine.

However, since I am using Xcode 4.0 and the website code used Xcode 3.X, the source is wildly different. Using WinMerge [on a Windows system, of course] reveals related but so different sources as to defy comparison.

An interesting difference however is the movies.plist file. My implementation has a "root", which is shown in Figure 8-15 on page 213. But the author's implementation does not have a "root". Is this significant?

It's blowing up at the last statement in cellForRowAtIndexPath:

cell.textLabel.text = [movieSection objectAtIndex:[indexPath row]];

I've inserted two NSLog statements, to see what "year" is selected and what "[indexPath row]" is returning. The year is "root" [not good] and the row is zero [good].

Sorry to whine, but this doesn't seem terribly robust. Perhaps some error checking [nil returns, etc] need to be inserted, but the program shouldn't go ka-boom.

Can anyone suggest where to check for errors? Thanks.
 
Old July 3rd, 2011, 01:52 PM
Authorized User
Points: 92, Level: 1
Points: 92, Level: 1 Points: 92, Level: 1 Points: 92, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: May 2011
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
Default Resolved

Used Dashcode to remove the "root" dictionary within a dictionary and now the program runs fine. Figure 8-15 is erroneous showing "root".
 
Old July 25th, 2012, 01:10 PM
Registered User
Points: 6, Level: 1
Points: 6, Level: 1 Points: 6, Level: 1 Points: 6, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jul 2012
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Same Issue

I had this same issue, however removing the root was not enough. It seems no matter what it would cash the old version when running the simulator.

I had to rename the Movies.plist to MovieList.plist and change it in code as well before it would not crash.

Is there a setting to force it to use a new version of the plist when you have made a change to it in the simulator?
 
Old July 26th, 2012, 11:19 AM
Registered User
Points: 6, Level: 1
Points: 6, Level: 1 Points: 6, Level: 1 Points: 6, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jul 2012
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Resolved app still crashing

I resolved the issue by uninstalling the Application from the simulator, and reinstalling. That finally got it to use the new Movies.plist without renaming it.

I am still very new to apple products




Similar Threads
Thread Thread Starter Forum Replies Last Post
Question about chapter 7 tableview dave1964 BOOK: Beginning iPad Application Development 4 February 21st, 2011 02:57 PM
Author's code for chapter 8, TableView has issues rcutshaw BOOK: Beginning iOS 4 Application Development 1 January 15th, 2011 05:45 PM
Chapter 6 - Code Download Missing for this Chapter dbaechtel BOOK: Professional SharePoint 2007 Development ISBN: 978-0-470-11756-9 0 August 11th, 2009 11:02 AM
Chapter 2 - End of chapter exercises whizzkid1892 BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0 1 July 30th, 2008 12:02 PM
Generics chapter 12 difficult chapter i found ...? Larryz C# 2005 1 July 4th, 2007 09:40 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.