sparrowcode / PermissionsKit

Universal API for request permission and get its statuses.
https://x.com/sparrowcode_ios
MIT License
5.64k stars 462 forks source link

App crashes for permissions #184

Closed ankitthakur closed 4 years ago

ankitthakur commented 4 years ago

Hi team, I have installed SPPermissions with Cocoapods.

pod 'SPPermissions/Camera'
pod 'SPPermissions/Contacts'
pod 'SPPermissions/Calendar'
pod 'SPPermissions/PhotoLibrary'
pod 'SPPermissions/Notification'
pod 'SPPermissions/Microphone'
pod 'SPPermissions/Reminders'
pod 'SPPermissions/SpeechRecognizer'
pod 'SPPermissions/Location'
pod 'SPPermissions/Motion'
pod 'SPPermissions/MediaLibrary'
pod 'SPPermissions/Bluetooth'

Now, I have also added required permissions in info.plist

<key>NSBluetoothPeripheralUsageDescription</key>
<string>App will use bluetooth, to share bluetooth state to other device</string>
<key>NSBluetoothAlwaysUsageDescription</key>
<string>App will use bluetooth for communication purpose only</string>
<key>NSCameraUsageDescription</key>
<string>App will use camera to share media files.</string>
<key>NSMicrophoneUsageDescription</key>
<string>App will use microphone for sending audio message</string>
<key>NSLocationAlwaysUsageDescription</key>
<string>App will use location, to share location to other device</string>
<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
<string>App will use location, to share location to other device</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string>App will use location, to share location to other device</string>
<key>NSPhotoLibraryAddUsageDescription</key>
<string>App will use document, to save in library.</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>App will use image, to update your profile picture.</string>

But the app is crashing on

 case .camera:
    #if SPPERMISSION_CAMERA
    return SPCameraPermission()
    #else
    fatalError(error(permission)) // here it is crashing.
    #endif

Crash logs:

Fatal error: SPPermissions - Camera not import. Problem NOT with usage description key. I recomend to see installation guide: https://youtu.be/1kR5HGVhJfk. More details in Readme: https://github.com/ivanvorobei/SPPermissions: file Pods/SPPermissions/Source/SPPermissions/Models/SPPermission.swift, line 125

ivanvorobei commented 4 years ago

Please, install pods with commands ‘pod update’. Better remove pods folder before.