Referee Timer App - Too Many Arguments/ Circular Reference

Hi all,

I've seen a lot of reference to these types of errors but I can't figure out why I am getting it in my app on my watch.

It runs fine in the simulator but not on my FR235. I've looked at it a hundred times but perhaps a fresh set of eyes will help!

Thanks in advance.

ERROR: Circular Dependency Error
DETAILS: Unfreed memory on exit
STORE_ID: 2934d288fd4b45ce95da8633875ddcad
ERROR: Circular Dependency Error
DETAILS: Unfreed memory on exit
STORE_ID: 2750f28082f44f21a32c57acc7ce4870
CALLSTACK:

ERROR: Too Many Arguments Error
DETAILS:
STORE_ID: 1341159e2ed9406590490157b0419e1f
CALLSTACK:
@PC = 0x00000000

ERROR: Too Many Arguments Error
DETAILS:
STORE_ID: 1341159e2ed9406590490157b0419e1f
CALLSTACK:
@PC = 0x00000000

ERROR: Too Many Arguments Error
DETAILS:
STORE_ID: 1341159e2ed9406590490157b0419e1f
CALLSTACK:
@PC = 0x00000000
  • In the ciq_log.txt you posted there are three different Store IDs (three different apps). Which is/are from your app?

    I'm guessing the last three are yours. There are a number of threads here about this and how you need to have a parameter now in onStart() and onStop() (now use onStart(state) and onStop(state) ). That might be the case.
  • When I get errors like this with an error message that doesn't help me, I sprinkle Sys.println("Here1"), Sys.println("Here2"), etc at intervals through the code. Then I look at the console log file on the watch to see how far the code execution got before failing. Then I can sprinkle more printlns in just the area where the error occurred. In 2 or 3 runs, you can find the line of code that's the culprit this way.

    You need to create the console log file as an empty text file in the Logs folder on the watch. [MyApp].txt
  • 710

    Thank you both for the help...and that you for being gentle with a noob!

    It was indeed the onStart(state) that seemed to be causing the error. I have now resolved this and the app is running fine. Hopefully i can return the favour in the future.
  • I looked over your code and have two comments.

    • You should explicitly return a value from most methods of the BehaviorDelegate. Return true if you've fully handled the input, or false if you want the system to apply the default handling.
    • I'm fairly certain you could simplify the code quite a bit by writing a timer class to encapsulate the timer pause/resume/start/stop as well as generating a string to represent the time. Something like the following might be a good start...


    class MyTimer
    {
    hidden var m_timer;
    hidden var m_paused;
    hidden var m_totalTime;

    function initialize() {
    m_paused = true;
    m_totalTime = 0;
    }

    function start() {
    _timer = new Timer.Timer();
    _timer.start(self.method(:onTimer), 1000, true);
    }

    function stop() {
    _timer.stop();
    _timer = null;
    }

    function is_stopped() {
    return _timer == null;
    }

    function pause() {
    m_paused = true;
    }

    function resume() {
    m_paused = false;
    }

    function is_paused() {
    return m_paused;
    }

    function toString() {
    var hh = m_totalTime / 3600;
    var mm = (m_totalTime / 60) % 60;
    var ss = m_totalTime % 60;

    if (hh != 0) {
    return Lang.format("$1$:$2$:$3$", [
    hh,
    mm.format("%02d"),
    ss.format("%02d")
    ]);
    }
    else {
    return Lang.format("$1$:$2$", [
    mm.format("%02d"),
    ss.format("%02d")
    ]);
    }
    }

    function onTimer() {
    }
    }