It looks like you're new here. If you want to get involved, click one of these buttons!
Hi there, I am updating some code for a simple app that is already published and working without issue. Everytime I run it in Codea, I get kicked out of Codea as it crashes.
The only code added is an if statement with a list, though I think it works ok perhaps I should try something else? Here is the code..please let me know if I am doing something stupid?
if year == 2014 and month == 4 and day == 6 or
year == 2014 and month == 5 and day == 14 or
year == 2014 and month == 6 and day == 13 or
year == 2014 and month == 7 and day == 12 or
year == 2014 and month == 8 and day == 10 or
year == 2014 and month == 9 and day == 9 or
year == 2014 and month == 10 and day == 8 or
year == 2014 and month == 11 and day == 6 or
year == 2014 and month == 12 and day == 6 then
fill(255, 255, 255, 104)
ellipse(WIDTH/2,HEIGHT/2,HEIGHT-50)
end
Anyone else having issues with Codea crashing and is there a way to see what causes a crash?
Comments
For one, try putting the and's in brackets, so (a & b & c) or (..)
Forgot to mention that Codea crashes intermittently so sometimes the code is running perfectly! The same is true if I run the original code before any updates so I don't think it is my code afterall. The app itself still works and I am using an iPad2 - iOS 7.1
I am wondering to back up projects and reinstall Codea?
@escape75, thanks for the info - I will try out your suggestion!
@jasi I put that if statement in the draw function and let it run for awhile. I would add 1 to the day and when day reached 31 I set it to 0 and added 1 to month. I could see the ellipse anytime one of the if condition matched. I had no crashes. I think you might have a problem with your other code.
@dave1707, I understand why you suggest it's more than likely a problem with the other code (I am certainly not a coding wiz) but then I am wondering why it never caused any issue before? Why would the app still run without problem and yet the code not run 100% of the time ok in Codea?
Here's the free app I made more as a test to try to get into coding...
https://itunes.apple.com/nl/app/coloc/id634583570?l=en&mt=8
@jasl Your app looks nice, but I didn't download it because that won't do me any good. I can't say why it doesn't work with Codea without seeing the code and seeing what happens when it crash. But there's nothing wrong with the above "if" statement running by itself when I ran tests with it.
@dave1707, there is one big block of code and you have helped me before (you will recognize it) which I really appreciate. I am now doubting myself and thinking the code must be a mess! (sorry for the formatting - I find it easier to read it this way without too much indentation - sacrilege I know - and obviously a couple of assets will be missing)
@jasl I loaded your code and reformatted it to make it easier for me to read. It does crash every now and then, but I haven't found a reason yet. I'll look over the code more and let you know if I find a reason why.
@jasl Make these changes to setup() and let me know if it still crashes. Comment out the c1. lines of code.
@dave1707 - Thanks! No longer crashing.. That was kind of embarrassing :-/ I learned a few things here though and that's good. Some of them being not to copy paste code from unfinished projects, to look for potential doubling in the code that makes no sense whatsoever and that I am clearly indebted to you.
I have no idea if you like beer but I'd definitely buy you a few any day!
@jasl That's the next step in programming, trying to figure out why code crashes. Once you get comfortable with programming, you can start learning why code doesn't work as expected and how to track it down.