Announcement

Collapse
No announcement yet.

ConnectIQ 2.3.1: method(:myMethod).invoke()= could not find symbol method (sometimes)

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • #16
    Originally posted by travis.vitek View Post

    I pasted your source into a simple sample program, set CUSTOM_FONT to false (because I didn't download your custom font) and did not see any problem in the simulator. I was able to reproduce the original problem posted by r.485 in the simulator, and my code above works around that problem. Do you only have problems on physical devices?
    Tested again with CUSTOM_FONT = false. I got a different error this time. Guess what, the errors are different if I build on eclipse and paste the prg file on the device or if I do build on Eclipse "build for device" and past on the device. The build for device may remove that information that I see here:

    ERROR: Symbol Not Found Error
    DETAILS: Could not find symbol Lang.
    STORE_ID: 00000000000000000000000000000000
    CALLSTACK:
    /home/cas/BodyFatControl/garmin_watchface/source/BodyFatControl_garmin_watchappView.mc (enableHRSensor:153)
    /home/cas/BodyFatControl/garmin_watchface/source/BodyFatControl_garmin_watchappView.mc (startSportMode:117)
    /home/cas/BodyFatControl/garmin_watchface/source/BodyFatControl_garmin_watchappView.mc (onKey:571)
    @PC = 0x30001c0d
    @PC = 0x30001e38

    The code on line 153: Sensor.enableSensorEvents(new Lang.method($, nSensorHR));

    And now the log if build for device:

    ERROR: Symbol Not Found Error
    DETAILS: Failed invoking <symbol>
    STORE_ID: 00000000000000000000000000000000
    CALLSTACK:
    @PC = 0x100003bc
    @PC = 0x10000175
    @PC = 0x10001ed0
    @PC = 0x30001c0d
    @PC = 0x30001e38

    Comment


    • #17
      With the "Build for Device Wizard", there's a checkbox at the bottom of the dialog: "Build Release Version of Project".

      I keep that box unchecked as I always want the debug symbols in a sideload. Sound like you have that box checked and the debug symbols aren't included in the .prg.

      Do you have a "using Toybox.Lang as Lang;" in you source file?
      Last edited by jim_m_58; 07-10-2017, 06:50 AM.
      My Connect IQ Apps in the Store
      Facebook - Instagram -
      Twitter

      Comment


      • #18
        I use Sensor.enableSensorEvents() in many apps, but have never had a problem like you're seeing. What I do, is in initialize() for the view, do the setEnabledSensors() call followed by enableSensorEvents() - something like Sensor.enableSensorEvents(method(:sensorEvents));. Seems you don't enable the events until there's a key press. Not sure why that might cause a problem, but if you get the sensors going right away, you stand a better chance of external sensors being connected when you're ready to go. (a Tempe can take a minute to connect, and an external HRM will take longer than an OHRM)
        My Connect IQ Apps in the Store
        Facebook - Instagram -
        Twitter

        Comment


        • #19
          Originally posted by travis.vitek View Post
          There are really multiple solutions. The more correct solution (in my mind) is to get rid of the global functions onPhone and onSensorHR by making them methods of a class and then registering them with the system from that class. You should be able to move all of the methods to your app class like this...

          Code:
          //
          // Note that I'm using C99 digraphs <% and %> to represent curly braces { and } below.
          //
          // This is only done so that I can post code to the forums. I cannot post code if I don't do this.
          // You will have to undo it if you actually use the code.
          
          class DFC extends App.AppBase {
          
          function initialize() <%
          AppBase.initialize();
          %>
          
          function onStart(state) <%
          Comm.registerForPhoneAppMessages(self.method(:onPhone));
          %>
          
          function onStop(state) <%
          Comm.registerForPhoneAppMessages(null);
          %>
          
          function getInitialView() <%
          return [ new DFC_garmin_watchappView(), new BaseInputDelegate()];
          %>
          
          //
          // the guts of the following functions should be moved from DFC_garmin_watchappView.mc to here
          //
          
          function onPhone(msg) <%
          %>
          
          function onSensorHR(info) <%
          %>
          
          function enableHRSensor() <%
          %>
          
          function disableHRSensor() <%
          %>
          }
          Tried that but didn't work, I get this error:

          ERROR: Invalid Value
          DETAILS: Failed invoking <symbol>
          STORE_ID: 00000000000000000000000000000000
          CALLSTACK:
          /home/cas/BodyFatControl/garmin_watchface/source/BodyFatControl_garmin_watchappView.mc (initialize:136)
          /home/cas/BodyFatControl/garmin_watchface/source/BodyFatControl_garmin_watchappApp.mc (getInitialView:23)

          Line 136: phoneMethod = method(nPhone);

          Code is here: https://github.com/BodyFatControl/ga...testing/source

          Comment


          • #20
            Originally posted by jim_m_58 View Post
            I use Sensor.enableSensorEvents() in many apps, but have never had a problem like you're seeing. What I do, is in initialize() for the view, do the setEnabledSensors() call followed by enableSensorEvents() - something like Sensor.enableSensorEvents(method(:sensorEvents));. Seems you don't enable the events until there's a key press. Not sure why that might cause a problem, but if you get the sensors going right away, you stand a better chance of external sensors being connected when you're ready to go. (a Tempe can take a minute to connect, and an external HRM will take longer than an OHRM)
            The thing is that my app is running 24h over 24h and so I just enable HR sensor when user want it enable (key press) and it disables automatically when HR < 90. Also, the sensor enables automatically when last minute of historic HR value > 90. The idea is to save battery.

            See here: https://apps.garmin.com/en-US/apps/e...4-3a4b263ff471

            Comment


            • #21
              Originally posted by lllllluuuu View Post
              /home/cas/BodyFatControl/garmin_watchface/source/BodyFatControl_garmin_watchappView.mc (initialize:136)
              /home/cas/BodyFatControl/garmin_watchface/source/BodyFatControl_garmin_watchappApp.mc (getInitialView:23)
              The call stack indicates you didn't remove the onPhone() stuff from your view class.

              Comment


              • #22
                Originally posted by travis.vitek View Post

                The call stack indicates you didn't remove the onPhone() stuff from your view class.
                Ok, changed that but now the error is on calling enableHRSensor();, that was before global:

                ERROR: Symbol Not Found Error
                DETAILS: Could not find symbol enableHRSensor.
                STORE_ID: 00000000000000000000000000000000
                CALLSTACK:
                /home/cas/BodyFatControl/garmin_watchface/source/BodyFatControl_garmin_watchappView.mc (startSportMode:90)
                /home/cas/BodyFatControl/garmin_watchface/source/BodyFatControl_garmin_watchappView.mc (onKey:471)
                @PC = 0x30001c0d
                @PC = 0x30001e38

                I don't know if is possible to make the code without using globals :-(

                Code here: https://github.com/BodyFatControl/ga...testing/source

                Comment


                • #23
                  Originally posted by lllllluuuu View Post
                  I don't know if is possible to make the code without using globals :-(
                  Of course it is possible. That function is a member of the app object, so you've got to call that function on the app object.

                  Travis

                  Comment


                  • #24
                    Originally posted by travis.vitek View Post
                    Of course it is possible. That function is a member of the app object, so you've got to call that function on the app object.

                    Travis
                    Thanks!! Got the app fully working again however I call Ui.requestUpdate(); from a method inside class BodyFatControl extends App.AppBase { and it works... I was not expect that. Anyway, it is fully working now :-)

                    Comment

                    Working...
                    X