ConnectIQ sdk - Swift integration issue

Former Member
Former Member
Hello,

After successfully implementing the connectIQ sdk in a objective C environment. I have unsettling issue with doing the same in a swift environment. Namely :
when I use showConnectIQDeviceSelection, GCM (Garmin Connect Mobile) does not call my app back using the URL scheme I provided.

On the project information, I use :
- Xcode 7.3 (7D175)
- ConnectIQ iOs sdk 1.2.6

Here are the solutions I have tried :
- check on the pdf (ConnectIQ_iOS_SDK.pdf) for forgotten steps.
- have only the AppDelegate and my only view in swift the rest is in objective C included via a bridging header.

Has anyone encountered such issues with swift and ConnectIQ sdk ? If yes, would you have any insight ?
Would you need more information about my current code or what I'm trying to do, I stay available.

Thanks in advance,
Scarlet
  • Former Member
    Former Member over 9 years ago
    Hi,

    I have issues with using ConnectIQ sdk in a swift iOs application.

    The issue seems to be when I call showConnectIQDeviceSelection.
    This function properly calls GCM, however GCM doesn't call my app back.

    Would anyone have any insight on this issue ?

    Thanks in advance.
  • I'm checking into this--unfortunately, I'm not familiar enough with Swift and support status with regard to the mobile SDK. I'll post back once I find out more.
  • I think the problem isn't related with swift, I tried with Objective-C and had the same result.

    In the app initialiser, I call
    [[ConnectIQ sharedInstance] initializeWithUrlScheme:@"aj-test-garmin" uiOverrideDelegate:self];
    and later with an IBAction I call
    [[ConnectIQ sharedInstance] showConnectIQDeviceSelection];

    The Garmin Mobile Connect app opens, but I don't see any UI to select a device (I never tried this before so I don't know what to expect), the app will start synchronizing with the watch, but nothing else happens.

    Checking the logs from the Garmin Mobile Connect app ( thanks for leaving the logs enabled )

    Apr 15 19:06:30 AJ-Phone ConnectMobile[1493] <Warning>: Handling openURL from com.aj.TestGarmin: gcm-ciq://device-select-req?ciqApp&ciqBundle=com.aj.TestGarmin&ciqScheme=aj-test-garmin&ciqSdkVersion=10000
    Apr 15 19:06:30 AJ-Phone ConnectMobile[1493] <Warning>: Received ConnectIQ message: gcm-ciq://device-select-req?ciqApp&ciqBundle=com.aj.TestGarmin&ciqScheme=aj-test-garmin&ciqSdkVersion=10000
    Apr 15 19:06:30 AJ-Phone ConnectMobile[1493] <Warning>: Source App: (null)
    Apr 15 19:06:30 AJ-Phone ConnectMobile[1493] <Warning>: Source Bundle: (null)
    Apr 15 19:06:30 AJ-Phone ConnectMobile[1493] <Warning>: Source SDK Version: (null)
    Apr 15 19:06:30 AJ-Phone ConnectMobile[1493] <Warning>: Unknown message type: device-select-req

    It looks to me that ConnectMobile doesn't support device-select-req anymore.

    Any idea why this is happening, maybe a regression?

    Have a great weekend.
  • Former Member
    Former Member over 9 years ago
    I had a similar problem and this answer helped me:


    "
    Hi gariel,

    i think you have to whitelist the url your app will call out using the LSApplicationQueriesSchemes key in your Info.plist. So please add:

    <key>LSApplicationQueriesSchemes</key>
    <array>
    <string>gcm-ciq</string>
    </array>

    Apple made some changes in iOS9 handling URL schemes. Here's a good explanation: http://awkwardhare.com/post/12119600...scheme-changes

    Thanks,
    Daniel"
  • Former Member
    Former Member over 9 years ago
    Oddly enough I can get the connectIQ sdk working with objective C (using the code samples provided). it seems to be an issue only for swift.

    The LSApplicationQueriesSchemes in the info.plist is the permission for calling GCM. however GCM doesn't call back the app. I think the issue is what alcidesjorge pointed out. Though this is weird behavior. I tried to get a hold with garmin but did not get any answer yet.

    I'll further experiment this week with the sdk (getting the uuid manually and trying to connect to it without GCM) and see where it goes.

    Kind regards.
  • Former Member
    Former Member over 8 years ago
    I can confirm the issue is not Swift. This post put me onto the solution...

    https://forums.garmin.com/showthread.php?308030-Show-my-fenix-3-in-my-IOS-app

    The additional step required is to add a "Bundle display name" key to the Custom iOS Target Properties. The value doesn't matter. The ExampleApp has one, and the post promises to update the doc. (select the target in the project and targets list, the the Info tab to edit Custom iOS Target Properties).

    Once in place, any of the 3 UIApplicationDelegate methods are now called by Garmin Connect (2 of the 3 are deprecated, so choose the non dep).

    func application(app: UIApplication, openURL url: NSURL, options: [String : AnyObject]) -> Bool {
    func application(application: UIApplication, openURL url: NSURL, sourceApplication: String?, annotation: AnyObject) -> Bool {
    func application(application: UIApplication, handleOpenURL url: NSURL) -> Bool {

    Best, Marti