Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > Programming > iPhone/iPad Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Feb 23, 2011, 08:47 PM   #1
Macman1993
macrumors 6502
 
Join Date: Nov 2007
Send a message via AIM to Macman1993 Send a message via MSN to Macman1993 Send a message via Yahoo to Macman1993
NSArray may not respond to '-length'

Not exactly what I am doing wrong here but I create an array of dictionaries from a .plist file and it appears to all work perfectly. I can access the files in it without any issues but when I try to call [array length] I get two warnings.

'NSArray' may not respond to '-length'
'Comparison between pointer and integer'

I cant tell what I am doing wrong here as I have called length a million times before. I am calling 'length' in a for loop, plugging the exact number by hand works but it will not always work since I can't know the size of the array in advance. Heres my code for initializing the array and the start of the for loop. Can someone please explain what I got wrong?

Code:
NSDictionary *dictionary = [NSDictionary dictionaryWithContentsOfURL:[NSURL URLWithString: @"http://web.suffieldacademy.org/~12clm/data.plist"]];
	
	
	NSArray *people = [dictionary valueForKey:@"People"];

	AppDelegate_Shared  *appDelegate =
	[[UIApplication sharedApplication] delegate];
	NSManagedObjectContext *context = [appDelegate managedObjectContext];
	NSError *error;

	//ISSUE HAPPENS HERE!!!!
	for (int i = 0;i<[people length]; i++) {
I have used breakpoints / other debug code and can verify that the line in question is what is causing the problem. When this line is run I get "SIGABRT" any help would be greatly appreciated.
__________________
17'' Unibody MBP 4 GB RAM 500 GB HD, 20'' iMac 2 GB RAM 250 GB HD, 16gb black iPhone 3g, 32gb black iPhone 3GS, 2 TB Time Capsule, 160 GB Apple TV, 32gb iPad 3g, Coming launch day: 32gb iPhone 4
Macman1993 is offline   0 Reply With Quote
Old Feb 23, 2011, 09:23 PM   #2
ulbador
macrumors 68000
 
ulbador's Avatar
 
Join Date: Feb 2010
It's not length. It's count. Make sure you read the sdk documentation, it would have quickly answered this.
__________________
Mooooooooooooo
ulbador is offline   0 Reply With Quote
Old Feb 23, 2011, 09:48 PM   #3
Macman1993
Thread Starter
macrumors 6502
 
Join Date: Nov 2007
Send a message via AIM to Macman1993 Send a message via MSN to Macman1993 Send a message via Yahoo to Macman1993
...woops, sorry I have spent to much time on Java recently, when I looked through the documentation I read count but it never occurred to me that I mixed the two up.
__________________
17'' Unibody MBP 4 GB RAM 500 GB HD, 20'' iMac 2 GB RAM 250 GB HD, 16gb black iPhone 3g, 32gb black iPhone 3GS, 2 TB Time Capsule, 160 GB Apple TV, 32gb iPad 3g, Coming launch day: 32gb iPhone 4
Macman1993 is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > iPhone/iPad Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
thread Thread Starter Forum Replies Last Post
Resolved: IApplication may not respond to '+mainWindow' webznz iPhone/iPad Programming 2 Apr 18, 2011 06:14 PM
warning: 'NSOpenGLView' may not respond to dbrayford Mac Programming 1 Jan 28, 2011 03:11 PM
Warning: UIView may not respond to '-view' AbhishekApple iPhone/iPad Programming 1 Dec 8, 2010 12:57 PM
`NSString may not respond to '-getItem'` -- How can I avoid this warning? (appscript) Warhaven Mac Programming 0 Mar 5, 2010 01:14 PM
warning balloons- warning: 'XXXViewController' may not respond to XXX mlecho iPhone/iPad Programming 8 Dec 24, 2009 05:32 PM


All times are GMT -5. The time now is 08:26 PM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

Privacy / DMCA contact / Affiliate and FTC Disclosure
Copyright 2002-2013, MacRumors.com, LLC