Communications.makeWebRequeston iPhone

Is there anything I should know about Communications.makeWebRequest on iPhone?

On Android, with the VA-HR connected to Android, it works fine and the app receives the expected data.
But when connected to my iPhone, nothing happens on the watch, indicating, I guess either no response or not a 200 response. On the phone, if IQ Connect is open, then it closes. I think that indicates something ugly is happening?. Is there a Connect IQ log on the phone that I can examine?
If IQ Connect is not open, nothing appears to happen.
(The phone has WiFi internet connection.)
[EDIT]
I have now added to my web request callback to display the response code. When Connect IQ is running on the phone, I get no response. When it is, (and closes as described above) I get a response code of -104.
On the Android, I get 200 whether Connect IQ is running or not.
  • I get a response code of -104.

    This indicates that the bluetooth connection is not available. I believe this can happen if bluetooth is off on your phone or if Garmin Connect Mobile is not running. You might try re-pairing your device in Garmin Connect Mobile.

    Travis
  • There definitely was a BT connection when I tried with CIQ running. It had just displayed "Sync Complete". And there must have been a connection as my app start on the watch caused CIQ to die!
    The -104 occurred on the second attempt, after CIQ closed on the first attempt. Maybe it took the BT connection down.
    But the real issues are (in descending order of importance):
    • What caused CIQ to die?
    • Why didn't the makeWebRequest succeed?
    • What can I do to troubleshoot further?

    [EDIT]
    The -104 is not reliable reproducible, I have seen -2 and no response with CIQ down

    Here's the request, in case I'm doing something silly:
    var url="---my web url---";
    var headers = {
    "Content-Type" => Comm.REQUEST_CONTENT_TYPE_URL_ENCODED,
    "Accept" => "application/json"
    };
    Comm.makeWebRequest(
    url,
    { "check"=>0,
    "GUID"=>Application.getApp().getProperty("GUID")}, // 0 if not set
    { :headers => headers,
    :method => Comm.HTTP_REQUEST_METHOD_POST,
    :responseType => Comm.HTTP_RESPONSE_CONTENT_TYPE_JSON
    },
    method(:loginCheckCallback)
    ) ;
  • Ok, CIQ is Connect IQ, and GCM is Garmin Connect Mobile (the app on your phone) :)

    One thing you might want to do in your app is check "phoneConnected" before you do the makeWebRequest(), and handle not being connected to the phone in a different way.

    Also, how are you pairing the watch to the iPhone? Are you paired in the phone settings, or are you paired in GCM?
  • Ok, CIQ is Connect IQ, and GCM is Garmin Connect Mobile (the app on your phone)

    OK, thanks :o
    One thing you might want to do in your app is check "phoneConnected" before you do the makeWebRequest(), and handle not being connected to the phone in a different way.

    OK, but, I've now added some more debugging, displaying response code and received data on the screen, and can see that I'm getting one 200 response with the correct data, but it's failing on the second I suspect, from observing the phone, that the first webrequest is crashing GCM.
    Also, how are you pairing the watch to the iPhone? Are you paired in the phone settings, or are you paired in GCM?

    That took me an hour to work out, but I do it in GCM.
  • I suspect, from observing the phone, that the first webrequest is crashing GCM.


    If you can, it would be helpful for the Garmin folks if you could produce a simple test case that causes this crash. If you manage to do that, post it to the Bug Reports forum (be sure to follow the rules).

    Travis
  • OK, I have just posted a bug report.
  • I posted the bug report six days ago and followed up with an email. No response to the post or to the email.

    How do I get someone to look at it?
  • The example project that demonstrated the issue is attached.
    It accesses a php script on my web site which returns a JSON containing pre-recorded track data and loads it into one of two buffers. It empties the active buffer every 10 seconds.
    To start, it calls the script twice, to fill two buffers, the calls the script every 10 seconds to refresh the empty buffer.
    It runs fine on Android and the emulator, but on iPhone it loads the first buffer then kills GCM on the phone which kills the HTTP calling process.
  • Former Member
    Former Member over 8 years ago
    Hi,

    I am new to Garmin development but am having the same problem on the widget that I am working on. Works fine on the simulator but fails on iOS and GCM crashes.

    I am using a Forerunner 235 and iPhone 6. Development is on OSX with Eclipse Neon.

    Have you found a workaround?
    Is it possible to load data into a widget in the background periodically so that it's ready when the user moves to that widget?
  • It's been verified as a bug:
    When GCM/iOS crashes when you include parameters in a Comm.makeWebRequest call.
    I't a show stopper for me but I have confirmation that as at yesterday, Garmin support have replicated the problem and passed it to the appropriate authorities.