Shinobi Controls (stopping a loop) iOS


#1

I have noticed that a lot of the examples supplied with Shinobi Controls seem to crash if let to run ad infinitum. I want a way to limit the number of iterations a process will perform. I am running this off a timer so the screen updates in realtime.
The calcs are performed in a method called update, so I put in a control as follows:

-(void)doStuff {
loopCount++;
if(loopCount >361){
[_timer invalidate];
_timer =nil;
}else{
update;    
}
}

This doesn’t quite work, but is there a way within Shinobi for handling this?


#2

Which controls are you using, and are there any specific examples you note as crashing if left to run?

Also, my first thought on your code snippet is there isn’t a loop. I would’ve thought you want

-(void)doStuff
{
    int loopCount = 0;
    do
    {
        update();
    } while (loopCount++ <= 360);

    [_timer invalidate];
    _timer = nil;
}

#3

Open xCode and run the continuous sinewave example - leave it for about 20 mins and look at the debug Window. If it doesn’t do this for you let me know and I’ll e-mail you my error screen.  


#4

I’ve just run the AppendData sample on the latest version of charts for about 30 minutes (20,000 datapoints) without any crashes, but if you email the debug to info@shinobicontrols.com, we can try looking into it further. What version of Charts were you using, which iOS version, and was it a device or simulator?