Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 03-01-2011, 10:11 AM   #1 (permalink)
Registered Member
 
Join Date: Feb 2011
Posts: 122
architectpianist is on a distinguished road
Question 10-digit index beyond bounds [0 .. 1]

Hi,
Take a look at this code:
Code:
NSLog(@"count = %i", [[connectDotsLineX objectAtIndex:index] count]);
		for (int newIndex = 0; newIndex < [[connectDotsLineX objectAtIndex:index] count]; newIndex++) 
		{
			int x1, x2, y1, y2;
			int previousIndex = newIndex - 1;
			x1 = [[[connectDotsLineX objectAtIndex:index] objectAtIndex:previousIndex] intValue];
			x2 = [[[connectDotsLineX objectAtIndex:index] objectAtIndex:newIndex] intValue];
			y1 = [[[connectDotsLineY objectAtIndex:index] objectAtIndex:previousIndex] intValue];
			y2 = [[[connectDotsLineY objectAtIndex:index] objectAtIndex:newIndex] intValue];
...
There doesn't appear to be anything wrong with it to me, but then I'm only a beginner. This section is giving me:
Code:
2011-03-01 09:55:24.737 The Escherizer[89042:207] count = 2
2011-03-01 09:55:24.739 The Escherizer[89042:207] *** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[NSMutableArray objectAtIndex:]: index 4294967295 beyond bounds [0 .. 1]'
Where did the 4294967295 come from?!? Only after I added those last 6 lines did it give me this exception. What is going on here?
Thanks!
architectpianist is offline   Reply With Quote
Old 03-01-2011, 10:27 AM   #2 (permalink)
Registered Member
 
Join Date: Oct 2009
Location: Amsterdam, The Netherlands
Posts: 782
TUX2K is on a distinguished road
Default

the 4294967295 looks like a pointer.

maybe you should rewrite your code so that is easier to debug.
__________________
If my answer helped you, you might want to help me.
Make a donation via PayPal.
TUX2K is offline   Reply With Quote
Old 03-01-2011, 11:17 AM   #3 (permalink)
Registered Member
 
simplyDusty's Avatar
 
Join Date: Jan 2011
Posts: 158
simplyDusty is on a distinguished road
Default

Where are you getting 'index' from?
simplyDusty is offline   Reply With Quote
Old 03-01-2011, 11:44 AM   #4 (permalink)
Registered Member
 
Join Date: Sep 2010
Posts: 324
mariano_donati is on a distinguished road
Default

Have you initialized index?... it looks like a trash value for me.
mariano_donati is offline   Reply With Quote
Old 03-01-2011, 03:10 PM   #5 (permalink)
Registered Member
 
Join Date: Jan 2011
Location: South Florida, US
Posts: 357
lgehrig1 is on a distinguished road
Default

0 - 1 = 4294967295

Your key line is as follows:

Code:
int previousIndex = newIndex - 1;
Because newIndex starts at 0, and you are subtracting 1, you get -1 (0x00000000 - 0x00000001 = 0xffffffff).

I'm not really looking at your code to try & figure out what it's doing, but if you need "now" and "then" you'll need to start at pos 1 on your outer loop, and do something special to handle your very first 0'th position.
lgehrig1 is offline   Reply With Quote
Reply

Bookmarks

Tags
bounds, index, nsmutablearray, objectatindex

Thread Tools
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
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 362
18 members and 344 guests
Absentia, akphyo, apatsufas, BinHex, cpsclicker, dre, Error404, Gaz, gmarro, jeroenkeij, Kirkout, MarkC, mottdog, Music Man, PavelMik, teebee74, whitey99, Wikiboo
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,666
Threads: 94,120
Posts: 402,898
Top Poster: BrianSlick (7,990)
Welcome to our newest member, cpsclicker
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 03:18 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0