Estimote / iOS-Fleet-Management-SDK

Estimote Fleet Management SDK for iOS
https://developer.estimote.com
MIT License
1.18k stars 398 forks source link

'Monitoring failed' in Proximity Example #274

Closed IncognitoCore closed 6 years ago

IncognitoCore commented 6 years ago

I'm trying to use the Proximity Example from this repo. After adding my APP ID and the beacon ID's the app should be good to go and I should see something working, right?

The XCode console tells me: Monitoring failed: This application is not authorized to monitor beacons, because of insufficient permission to use Location Services.

The app displays an alert showing 'Monitoring failed' with reason 'Make sure bluetooth is on and the app has permission to use it.'

The app never asked me for permissions but they are in the .plist file. Is this something I need to write myself or should this work out-of-the-box?

The full error: Error Domain=ESTMonitoringV2ManagerErrorDomain Code=5 "This application is not authorized to monitor beacons, because of insufficient permission to use Location Services." UserInfo={NSLocalizedDescription=This application is not authorized to monitor beacons, because of insufficient permission to use Location Services.}

przemekblasiak commented 6 years ago

Hey @IncognitoCore 👋 Thank you for bringing that up! It should work out-of-the-box as you say, expect an updated version of the templates soon 😉 (@beardaway is cracking it as we speak 💪).

It's broken because of the new policy we use for Location Services permissions in the SDK. We used to ask for these permissions implicitly when starting monitoring, but a developer wouldn't have any control over permissions this way (e.g. what if a user disagrees?). That's the reason we switched to manual permission requesting (like you do when using Apple's Core Location).

That's how it all works now:ESTMonitoringV2Manager provides an interface for requesting permissions with either -requestAlwaysAuthorization or -requestWhenInUseAuthorization. • ESTMonitoringV2Manager also provides a readonly property to check for current authorizationStatus. • ESTMonitoringV2ManagerDelegate is additionally informed whenever the authorization status changes with -monitoringManager:didChangeAuthorizationStatus:authorizationStatus.

Does that answer your question? What do you think about all of that?

konradsopala commented 6 years ago

Hey @IncognitoCore !

We've fixed the issue last week, so you should be able to download working version of any template you want from our cloud: https://cloud.estimote.com/#/apps.

Sorry for the inconvenience 🙏 Now everything should work out of the box 📦

prietousa commented 6 years ago

I am having a similar issue with my app (not using a template, though). I am trying to add the func requestAuthorization() on appdelegate. But it doesn't get trigger and I keep getting the didFailWithError. Please advise

monitoringManager didFailWithError: This application is not authorized to monitor beacons, because of insufficient permission to use Location Services.

UPDATE: after looking into the template I realized that you guys have created multiple extension in order to make the authentication work correctly.

extension NotificationManager: ESTMonitoringV2ManagerDelegate extension NotificationManager