Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8255297
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T01:28:29+00:00 2026-06-08T01:28:29+00:00

i’m kinda new to Objective-C so i have been learning with the Head First

  • 0

i’m kinda new to Objective-C so i have been learning with the Head First iPhone & iPad Development book. In this book, at the Chapter 4-5 you suppose to design an app for a bartender, that basically is a table view of a list of drinks with the details list (it suppose to have the ingredients and directions for the drink selected). The data comes from two property lists, one has a list of strings with the names of the drinks, and the other is a Dictionary that has the name, directions and ingredients of the drinks.

I have followed the tutorial and the app crashes, re-checked it and still crashes. I’m using an Xcode Version of 4.0.1 and MAC OS X 10.6.8.

Here is the exception, i hope that you guys can check out what happens at this simple application.

2012-07-19 21:43:39.757 DrinkMixer[846:207] -[NSCFString objectForKey:]: unrecognized selector sent to instance 0x4b31220

2012-07-19 21:43:39.761 DrinkMixer[846:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSCFString objectForKey:]: unrecognized selector sent to instance 0x4b31220'

    *** Call stack at first throw:

    (

    0   CoreFoundation                      0x00dc25a9 __exceptionPreprocess + 185

    1   libobjc.A.dylib                     0x00f16313 objc_exception_throw + 44

    2   CoreFoundation                      0x00dc40bb -[NSObject(NSObject) doesNotRecognizeSelector:] + 187

    3   CoreFoundation                      0x00d33966 ___forwarding___ + 966

    4   CoreFoundation                      0x00d33522 _CF_forwarding_prep_0 + 50

    5   DrinkMixer                          0x00002495 -[RootViewController tableView:cellForRowAtIndexPath:] + 325

    6   UIKit                               0x00089b98 -[UITableView(UITableViewInternal) _createPreparedCellForGlobalRow:withIndexPath:] + 634

    7   UIKit                               0x0007f4cc -[UITableView(UITableViewInternal) _createPreparedCellForGlobalRow:] + 75

    8   UIKit                               0x000948cc -[UITableView(_UITableViewPrivate) _updateVisibleCellsNow:] + 1561

    9   UIKit                               0x0008c90c -[UITableView layoutSubviews] + 242

    10  QuartzCore                          0x016aca5a -[CALayer layoutSublayers] + 181

    11  QuartzCore                          0x016aeddc CALayerLayoutIfNeeded + 220

    12  QuartzCore                          0x016540b4 _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 310

    13  QuartzCore                          0x01655294 _ZN2CA11Transaction6commitEv + 292

    14  UIKit                               0x000169c9 -[UIApplication _reportAppLaunchFinished] + 39

    15  UIKit                               0x00016e83 -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 690

    16  UIKit                               0x00021617 -[UIApplication handleEvent:withNewEvent:] + 1533

    17  UIKit                               0x00019abf -[UIApplication sendEvent:] + 71

    18  UIKit                               0x0001ef2e _UIApplicationHandleEvent + 7576

    19  GraphicsServices                    0x00ffb992 PurpleEventCallback + 1550

    20  CoreFoundation                      0x00da3944 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 52

    21  CoreFoundation                      0x00d03cf7 __CFRunLoopDoSource1 + 215

    22  CoreFoundation                      0x00d00f83 __CFRunLoopRun + 979

    23  CoreFoundation                      0x00d00840 CFRunLoopRunSpecific + 208

    24  CoreFoundation                      0x00d00761 CFRunLoopRunInMode + 97

    25  UIKit                               0x000167d2 -[UIApplication _run] + 623

    26  UIKit                               0x00022c93 UIApplicationMain + 1160

    27  DrinkMixer                          0x00001c89 main + 121

    28  DrinkMixer                          0x00001c05 start + 53

    )

    terminate called after throwing an instance of 'NSException'

    sharedlibrary apply-load-rules all

    (gdb) 

And here is exactly when the app crashes, at the objectForKey:@”name”

- (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];

    }

    cell.textLabel.text = [[self.drinks objectAtIndex:indexPath.row] objectForKey:@"name"];

    return cell;

}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T01:28:30+00:00Added an answer on June 8, 2026 at 1:28 am

    the clue in the first line of the error is that you have initialized the contents of self.drinks at the index that corresponds to indexPath.row to be an NSString. when that objectAtIndex: is retrieved, it is then passed the message objectForKey: as though it is an NSArray.

    look at the code where you’ve initialized self.drinks and make certain you’ve made it an appropriate array containing appropriate contents. in your case, it would be an array of NSDictionary* for objectForKey: to work).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a jquery bug and I've been looking for hours now, I can't
this is what i have right now Drawing an RSS feed into the php,
I have this code to decode numeric html entities to the UTF8 equivalent character.
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I have some data like this: 1 2 3 4 5 9 2 6
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
I have just tried to save a simple *.rtf file with some websites and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.