2 Replies
      Latest reply on May 2, 2020 9:50 AM by Aviametrix
      Aviametrix Level 1 Level 1 (0 points)

        I am updating an existing watchOS App previously paired to an iOS App to a new Independent App. The app uses the CoreMotion framework, specifically CMAltimeter. In the old version of the app, the user had to authorize CM access in the paired iphone for both the phone and watch.

         

        I am trying to find a watchOS equivalent of requestAuthorizationWhenInUse, but I can not find it. I must assume that Privacy Authorization is still required. Apple has examples for the Health and Notifications frameworks, but rooting around I can not find a similar request method to generate a permission alert dialog from CoreMotion. Per the Apple Dox, CoreMotion only exposes AuthorizationStatus(). The watchkit extension pList does contain the appropriate privacy permission descriptions.

         

        Anyone successfully climb this hill?

        • Re: watchOS 6 privacy Permission
          Claude31 Level 8 Level 8 (9,145 points)

          Did not try yet.

           

          But,

           

          did you register the WatchOS app ?

          https://developer.apple.com/documentation/watchkit/adding_notifications_to_your_watchos_app?preferredLanguage=occ

           

          Sending Remote Notifications Directly to Apple Watch

           

          With watchOS 6 and later, you can send remote notifications directly to Apple Watch. Before sending a notification, you must register your watchOS app, as described in Registering Your App with APNs. Registering your app creates a unique device token for the watch. Use that token to send notifications directly to the watch.

          The recommended notification strategy depends on your watchOS app, as shown in the table below.

          Type of app

          Notification strategy

          Apple Watch-only app

          Always send remote notifications to Apple Watch.

          Independent watchOS app with an iOS app

          Because the app may not be installed on both devices, you should always send the notification to both iPhone and Apple Watch. The system ensures that the user only receives one notification at the best destination.

          Dependent watchOS app with an iOS app

          You can either send the notification just to iPhone, or send it to both devices. In either case, the system ensures that the user only receives one notification at the best destination.

           

          For more information on watchOS app types, see Creating Independent watchOS Apps.

           

          Did you watch WWDC2019 / 208 ?

               https://developer.apple.com/videos/play/wwdc2019/208/

          Here its transcript

               h ttps://asciiwwdc.com/2019/sessions/208

            • Re: watchOS 6 privacy Permission
              Aviametrix Level 1 Level 1 (0 points)

              Thanks for the reply!!

              I've watched the WWDC 19 video. It just glosses over permissions entirely without any details, except to say that a mechanism for Health is added in watchOS 6. Notifications also has an explicit permission system (I have not looked nn detail at it), but I am only trying to use CoreMotion which in iOS 5 needed permission on the paired phone AND inside the Watch app on the paired phone. I can not find an API to request permission on a standalone watch in watchOS 6.  I have a switch statement on the result of

              let auth = CMAltimeter.authorizationStatus()

               

              What should I execute in the case .notDetermined ?