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 04-08-2011, 06:22 AM   #1 (permalink)
Registered Member
 
Join Date: Mar 2011
Posts: 35
Kenenth is on a distinguished road
Default Some errors I need help with? (10)

Well first of all, to start, I think something is screwed up with my sdk. Everytime I run my program and I have some sort of warning , or error, it says I have double that amount of actual errors that I have. Whatever.


So to my app, I get a couple of errors with these parts of code:

Code:
for (int x=0; x < [bulletArray count]; x++) {
			
			UIImageView *Bullet = [bulletArray objectAtIndex:x];
			NSInteger sliderAngleValue = [bulletValuesArray objectAtIndex:x];
			Error:Initialization makes integer from pointer without a cast
			//CGPoint bulletPos = CGPointMake(0, 0);
			
			
			
			if(sliderAngleValue<0){
				
				CGPoint bulletPos = CGPointMake(sliderAngleValue*10,-5-(sliderAngleValue*10));
				Bullet.center = CGPointMake(Bullet.center.x+bulletPos.x, Bullet.center.y+bulletPos.y);
Error: Local declaration of bulletPos hides instance variable.
				
			} else {
				
				CGPoint bulletPos = CGPointMake(sliderAngleValue*10,-5+(sliderAngleValue*10));
				Bullet.center = CGPointMake(Bullet.center.x+bulletPos.x, Bullet.center.y+bulletPos.y);
Error: Local declaration of bulletPos hides instance variable.
			}
			
		}
I might have imbalanced parenthesis, but thats just a copy thing. so basically I created a shooter game. When the user fires a bullet, it is stored in an array called bulletArray, and I use a slider that the user can slide to rotate the turret. At the same time I store the value of the slider into an array, bulletValuesArray. I retrieve these two things above, and then in the if statements I just use the formula to move the bullet wherever the user has fired it by running through all of the bullets and values, but I have a couple problems above. These are just errors but my program is crashing with them. Thanks in advance!
Kenenth is offline   Reply With Quote
Old 04-08-2011, 06:32 AM   #2 (permalink)
Nuisance Developer
 
Join Date: Jul 2009
Location: Italy
Posts: 4,691
dany_dev is on a distinguished road
Default

what contain bulletArray? i don't think it contain NSInteger, since that is not an object, and NSArray can contain only objects, maybe NSNumber?

The other warning is because you have somewhere (for example .h) a variable named bulletPos, so when you are creating another variable with the same name, you are "confounding" the compiler (best again you are confounding yourself ) just change name to that variable...

Quote:
CGPoint bulletPosIntern = CGPointMake(sliderAngleValue*10,-5-(sliderAngleValue*10));
Bullet.center = CGPointMake(Bullet.center.x+bulletPosIntern.x, Bullet.center.y+bulletPosIntern.y);
__________________

Last edited by dany_dev; 04-08-2011 at 06:41 AM.
dany_dev is offline   Reply With Quote
Reply

Bookmarks

Tags
crash, iphone, warning

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: 355
13 members and 342 guests
dansparrow, dre, ilmman, LezB44, michelle, Nobbsy, Objective Zero, samdanielblr, Sami Gh, shagor012, sledzeppelin, thephotographer, tinamm64
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,663
Threads: 94,119
Posts: 402,896
Top Poster: BrianSlick (7,990)
Welcome to our newest member, LezB44
Powered by vBadvanced CMPS v3.1.0

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