-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Is the objc2-core-location package working (and is there an example for it?) #708
Comments
I have a suspicion that the problem is that you haven't configured your It also doesn't help that the usual website for finding information about Looking quickly, it seems like Tauri has support for custom |
I had the Info.plist file populated but I was missing the "protocol-asset" feature flag (I was previously under the impression it would just work) Populating my Info.plist as follows still does not prompt anything to happen nor does the app show up under <?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>NSLocationWhenInUseUsageDescription</key>
<string>App would like to request your location</string>
<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
<string>App would like to request your location</string>
<key>NSLocationUsageDescription</key>
<string>App would like to request your location</string>
</dict>
</plist> |
So it turns out we're getting further than we were before. Previously, LocationManager was always null but now it's actually populating. let authorization_status = manager.authorizationStatus(); gives us a manager.requestWhenInUseAuthorization();
// or
manager.requestAlwaysAuthorization(); does nothing at all. |
Interestingly enough, building it for production does indeed correctly prompt the user to allow location access. I have a way forward for the time being but it does suck that I haven't been able to figure out how to enable it when running the |
By "building it for production", do you mean building inside Xcode? A vague guess, maybe you need to code-sign the bundle? |
By building for production, I mean running On macOS, this produces a .dmg image that contains the application (.app folder), which includes the Info.plist that we initially kept in the folder When running a dev build using |
Ah, yeah, that won't work then, and there probably isn't a way around it, you have to bundle for macOS to see the If you really want to get adventurous, I guess you could try to embed the |
The docs make it look so simple! - I'll probably try it out tomorrow! Since I had this working earlier today by the way - I haven't been able to get my app to re-authenticate - though it was working at one point and I'm certain it'll work again. (It's just hard testing once you've bundled a production ready version of the app) |
probably not worth it tbh. i doubt we'll fix this. we had this behavior years ago for a really short time but it caused more issues than it was worth (don't ask me what it was, that was before my time). We recently also switched back from For the foreseeable future we'll stick to Maybe we can add this behavior alongside the current one that runs when an info.plist file is detected (with a flag if people need the cargo run behavior) but atm i just don't see it.
It wasn't with location services but something else i tested a looong time ago required me to use |
That's honestly pretty fair - even just trying to get it working right now and just barely succeeding, I can see why. The kind of rewrite necessary to achieve something similar here is quite an undertaking. For anyone else interested, The GeoLocation services that my app required were to simply get the current place someone was located to be able to set and store longitude and latitude data long term (effectively think of it like getting their home address). For now, I've prompted to go for a method where it launches a website that then asks for your location and deeplinks it back to the app which works pretty well. It's not the ideal way to have done things but this works fine if they're simply requesting location access once in a blue moon. |
I'm using Tauri to build an app for macOS (plus other platforms later on) and it requires access to location data to populate the longitude and latitude so it can be sent to an API. I'm not too well-versed in rust just yet (though I've got my feet wet and I'm starting to learn how to float) so I'm not 100% sure if I'm even using the library correctly.
I found a bit of code on a thread in the Tauri discord channel and have modified it just slightly but basically I call
request_location_permission
at the start of my entryPoint into the app and it seems I can never get theCLLocationManager
instance needed to ask for the location permissions.Here's my code:
Any help would be greatly appreciated (and if I can provide some extra details, please, do let me know!)
The text was updated successfully, but these errors were encountered: