jevonmao / PermissionsSwiftUI

A SwiftUI package to beautifully display and handle permissions.

Home Page:https://jevonmao.github.io/PermissionsSwiftUI/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[BUG] - Health authorization read only crash

gharary opened this issue · comments

Describe the bug
A clear and concise description of what the bug is.

PermissionSwiftUI 1.4.1
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Must request authorization for at least one data type'

To Reproduce

let readData = Set([HKObjectType.workoutType(),
                                    HKObjectType.quantityType(forIdentifier: .stepCount)!,
                                    HKObjectType.quantityType(forIdentifier: .distanceWalkingRunning)!,
                                    HKObjectType.quantityType(forIdentifier: .activeEnergyBurned)!
                                    ,HKObjectType.quantityType(forIdentifier: .appleStandTime)!
                                    ])

.JMModal(showModal:$showPermission,for:[.locationAlways,.health(categories: .init(read: readData)),.notification])

Expected behavior
A clear and concise description of what you expected to happen.

in mapPermissionAuthorizationStatus, input is Set<HKSampleType>, however I'm using HKObjectType and it cause error

***Update:
Tried with HKSampleType but still crash as I click to allow permission of Health.

*** update:
tried to downcast to PermissionSwiftUI 1.3.0, everything working fine!

@gharary Acknowledged. Will try to reproduce and confirm this bug later today.

Please try newest version @gharary