[iOS] getAppStatus always return nil can not connect app

Former Member
Former Member

I'm developing a companion app.

My GARMIN IQ app manifest.xml is 

<?xml version="1.0"?>
<iq:manifest version="3" xmlns:iq="http://www.garmin.com/xml/connectiq">
    <iq:application id="891476df-2735-44c8-a8bb-d1xxxxxxxxxx" type="watch-app" name="@Strings.AppName" entry="App" launcherIcon="@Drawables.LauncherIcon" minApiLevel="1.2.0">
        <iq:products>
            <iq:product id="epix2"/>
        </iq:products>
        <iq:permissions>
            <iq:uses-permission id="Communications"/>
        </iq:permissions>
        <iq:languages/>
        <iq:barrels/>
    </iq:application>
</iq:manifest>

I installed my app on my physical device (EPIX GEN 2) by copying the "app.prg" in the director GARMIN/Apps and I can run my app on the device.

The connection to the device in my iOS app is working well but when I try to connect to an app I have an issue, here my Objective-C code:

- (void)connectApp:(IQDevice *)device {
  NSUUID *uuid = [[NSUUID alloc] initWithUUIDString:@"891476df-2735-44c8-a8bb-d1xxxxxxxxxx"];
  IQApp *app = [IQApp appWithUUID:uuid storeUuid:[NSUUID UUID] device:device];
  [[ConnectIQ sharedInstance] getAppStatus:app
                                completion:^(IQAppStatus *appStatus) {
      if (appStatus != nil && appStatus.isInstalled) {
        NSLog(@"App is installed! Version: %d", appStatus.version);
        [[ConnectIQ sharedInstance] registerForAppMessages:_app delegate:self];
      } else {
        NSLog(@"Can not find app on device");
        // Redirect to store to install the app
        [[ConnectIQ sharedInstance] showConnectIQStoreForApp:app];
      }
  }];
}

My appStatus is always nil so I can not connect to the app. 

Top Replies

All Replies

  • Former Member
    0 Former Member

    HI finally managed to solve this issue.

    The fact is I tried to connectApp when the device status changed to CONNECTED. Even if the status is CONNECTED the SDK can not fetch app status. I tried to add a delay to call connectApp but it's not working.

    I finally managed to solve this by not calling connectApp on the status changed to CONNECTED but manually from a user Action