Help! Xcode error that doesn't happen in codea - FIXED


So I’m desperately trying to upload the game finally.

There are no errors in the Codea environment and the game runs great.

When I bring it into Xcode and run it on both an iPhone 6S and and an iPad Mini 2 I get this new nil value error in two places. There are no nil values so I wonder if something Xcode is doing is missing the value.

I had it in previous Xcode last night and in the 5th June release update to Xcode. Both devices are on the latest iOS

The line 144 error goes after a it discovers the other error.

Just to clarify the global variable isn’t a variable but is defining an instance of the class called ‘Midfield’

mf1=Midfield(g, scY*20, scX*40, scY*20,hspeed*1)
mf2=Midfield(g, scY*40, scX*40, scY*20,hspeed*1)
mf3=Midfield(g, scY*60, scX*40, scY*20,hspeed*1)
mf4=Midfield(g, scY*80, scX*40, scY*20,hspeed*1)
mf5=Midfield(g, scY*100, scX*40, scY*20,hspeed*1)
mf6=Midfield(g, scY*120, scX*40, scY*20,hspeed*1)
mf7=Midfield(g, scY*140, scX*40, scY*20,hspeed*1)
mf8=Midfield(g, scY*160, scX*40, scY*20,hspeed*1)
rf1=Rockfield(g, scY*20, scX*50, scY*20,hspeed*1)
rf2=Rockfield(g, scY*40, scX*50, scY*20,hspeed*1)
rf3=Rockfield(g, scY*60, scX*50, scY*20,hspeed*1)
rf4=Rockfield(g, scY*80, scX*50, scY*20,hspeed*1)
rf5=Rockfield(g, scY*100, scX*50, scY*20,hspeed*1)
rf6=Rockfield(g, scY*120, scX*50, scY*20,hspeed*1)
rf7=Rockfield(g, scY*140, scX*50, scY*20,hspeed*1)
rf8=Rockfield(g, scY*160, scX*50, scY*20,hspeed*1)

If I comment out the first of those lines (line 144) it throws up the error as line 145. This is part of the setup code in main.

And here is the other error:

if explodecount>0 then


@Majormorgan I have dealt a lot with xCode errors. Your error is somewhat common. If the variable explodecount is set up in the setup function, then this is your error…

In Codea, there is a compiler that prohibits you from running a program unless all syntax errors are fixed. In xCode, that compiler does not exist, so what it does is it doesn’t properly set up the variables in the setup function.

I recommend that you check for syntax errors (2 equal signs in “if” conditions, “end” for every function, etc.)

If the error keeps popping up, just show us what happened. Best of luck!

thanks @CamelCoder - actually all the variables were fine. There was a line I commented out using the mac text editor and I think it merged the two dashes into a big dash, but in a different class. And with that correwcted it all runs fine.

Thanks all!