asyncswift / asynclocationkit Goto Github PK
View Code? Open in Web Editor NEW📍async/await CoreLocation
License: MIT License
📍async/await CoreLocation
License: MIT License
Hi,
I get a crash on macOS on the following line in AuthorizationPerformer.swift:
if await applicationStateMonitor.hasResignedActive {
changing it to the follow helps:
if let applicationStateMonitor, await applicationStateMonitor.hasResignedActive {
It seems as de delegate is called before
applicationStateMonitor = await ApplicationStateMonitor()
is completed in the start
function.
Not sure why and not sure if my workaround is the best or have other side effects, but seems to work for me.
locationManager.requestLocation never returned even it didn't throw any error @humblehacker
This framework looks promising, but I noticed it's missing support for CLLocationManager.requestTemporaryFullAccessAuthorization()
How would we go about updating the accuracy after the stream has started?
Thanks
The below implementation is not invoking the print statements although the library is setup properly and working for the startUpdatingLocation().
Task{
self.region = CLCircularRegion(center: location.coordinate, radius: 100, identifier: "DPMonitoredRegion")
for await event in await asyncLocationManager.startMonitoring(for: region){
switch event{
case .didExitTo(let region):
print("did exit region \(region.identifier)")
case .didStartMonitoringFor(let region):
print("did start monitoring current region: \(region.identifier)")
case .monitoringDidFailFor(region: let region, error: let error):
print("region: \(String(describing: region?.identifier)), error: \(error.localizedDescription)")
case .didEnterTo(region: let region):
print("did enter to region \(region)")
}
}
I tried debugging and it somehow fails to enter the if statement in the AsyncDelegateProxy only when the RegionMonitoringPerformer calls it:
func eventForMethodInvoked(_ event: CoreLocationDelegateEvent) {
for performer in performers {
if performer.eventSupported(event) {
performer.invokedMethod(event: event)
}
}
}
thanks in advance
Originally posted by lmillett October 25, 2022
In my app I would like to check what location permissions have already been authorized before I ask them to grant me location permission. That way I'm not forced to ask for permissions before they have even used the app. I can delay it to a later point when they do an operation that really requires that authorization.
I have that change made locally to my package and it seems to work as I would like it to.
Happy to submit that change if others agree.
Hello.
Thank you for AsyncLocationKit.
Would you delete development
? I see all pull requests are using main
as target. Or what is the purpose of development
?
The desired accuracy convenience initialiser doesn't appear to be setting the desiredAccuracy of the wrapped LocationManager. This is fixed by #27
Just by importing the library into my app Clip Target in Xcode I get the following error/warning when uploading to TestFlight/AppStore:
ITMS-90842: Invalid SDK usage - App clip 'BuildTarget_AC_Base.app/AppClips/BuildTarget_AppClip.app' uses the SDK selector 'requestAlwaysAuthorization', which is not supported. Ensure your app clip is using supported SDK features.
In the rest of my code I use a "#if APPCLIP" to skip code that reference API that are not allowed in AppClips. Is it possible to solve this in the framework as well?
I have existing code based on PromiseKit that I am migrating to Swift Concurrency, and in migrating it to use AsyncLocationKit, my actual sequence of events differed from your sample code in the README.md. Because of this, I created an AsyncLocationManager instance inside an async function, it didn't work at all, due to that fact that AsyncLocationManager's initializer creates a CLLocationManager without first switching to the main thread. It took me a long time to figure out what was wrong. Because of this, I would suggest that AsyncLocationKit do one or more of the following:
AsyncLocationManager.init
that throws an exception if there isn't an active RunLoop on the current thread. (I don't actually know how to check this, since RunLoop.current
will create an inactive RunLoop on the current thread when called on a thread with no RunLoop.)AsyncLocationManager.init
to be wrapped in a call to DispatchQueue.main.sync()
if it is called from anything other than the main thread. (Note: calling DispatchQueue.main.sync()
on the main thread will result in deadlock, so this would need to check Thread.isMainThread
.)AsyncLocationManager.init
and AsyncLocationManager.init(desiredAccuracy:)
states the fact that they must be called from a thread with a RunLoop.In short, given that AsyncLocationManager is designed to be used from async code, the fact that it must be constructed outside of async code is something that I feel should be either mentioned in the documentation, or corrected to not be the case. I realize that CLLocationManager itself makes it clear in its main class documentation that there must be a RunLoop at the time of initialization. But it is not at all clear (to me, anyway) that the same is also true of AsyncLocationManager, and AsyncLocationManager's very nature of being used with async code makes it much more likely to be created from an async function.
Could you add support for WatchOS? Currently it is failing to build because of references to regions, beacons and visits that are note available on the Watch.
I didn't find APIs related to startMonitoringSignificantLocationChanges
.
Can you point me to the relevant code if I missed something?
Thanks.
Always authorization request returns
Always authorization request never returns, since the underlying call to CLLocationManager.requestAlwaysAuthorization()
fails silently.
This one is tricky, as there's no straightforward way to tell the difference between when the uses taps Allow While Using App
– which will allow a follow-on call to CLLocationManager.requestAlwaysAuthorization()
– and Allow Once
– which will not. I'm investigating this approach.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.