• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
NSArray problems
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSArray problems


  • Subject: NSArray problems
  • From: Daniel Richman <email@hidden>
  • Date: Sun, 27 Jul 2008 19:52:34 -0700

Hi All,

I've been having some strange problems with an NSArray. It's probably something obvious, but I can't figure it out.

I have an AppController class with an NSArray instance value, called numbers. numbers stores NSStrings (which are numbers, but I don't need them as ints or anything). The code is as follows (allNumbers is all the numbers squished together):

numbers = [allNumbers componentsSeparatedByString:@"\t"];

NSLogging immediately after this reveals that this code is fine: the numbers have all ended up (as strings) into the array called numbers.

The numbers are supposed to be displayed in a table view, for which the AppController is set as the data source. But something seems to be going wrong with the array before the table view starts asking for data, because the contents of the array have become other, non string things. The following is a sample from GDB:

Running…
2008-07-27 19:46:37.064 Random[2698:813] numbers 0 is 3
2008-07-27 19:46:37.071 Random[2698:813] numbers 1 is 24
2008-07-27 19:46:37.083 Random[2698:813] numbers 2 is 84
2008-07-27 19:46:37.091 Random[2698:813] numbers 3 is 80
2008-07-27 19:46:37.100 Random[2698:813] numbers 4 is 81
(gdb) step

... lots of steps through AppKit & Foundation functions ...

Single stepping until exit from function -[NSApplication run],
which has no line number information.
(gdb) po numbers
NSRectSet {{{1, 0}, {242, 178}}}
(gdb) print (int) [numbers count]
$2 = 1
(gdb) print (id) [numbers objectAtIndex:0]
Target does not respond to this message selector.


So I'm befuddled. Any ideas? Sorry for the long post.

Daniel
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: NSArray problems
      • From: Andy Lee <email@hidden>
    • Re: NSArray problems
      • From: Chris Suter <email@hidden>
  • Prev by Date: Re: NSDocument and window ivar
  • Next by Date: Re: Working with mathematical errors
  • Previous by thread: Re: NSDocument and window ivar
  • Next by thread: Re: NSArray problems
  • Index(es):
    • Date
    • Thread