Comments (8)
Hey LucasZL,
there is no need to dismiss the STLocationRequestController manually. The STLocationRequestController will dismiss itself when the user tapped the NotNow-Button or accepted or denied the location request.
So please give me a code sample how you call the STLocationRequest Screen.
Preferred way in Swift, is to use the UIViewController Extension:
import STLocationRequest
func showLocationRequest(){
self.showLocationRequestController(
setTitle: "We need your location for some awesome features",
setAllowButtonTitle: "Alright",
setNotNowButtonTitle: "Not now",
setMapViewAlphaValue: 0.9,
setBackgroundViewColor: UIColor.lightGrayColor(),
setDelegate: self)
}
Also don't forget to apply to the LocationRequestDelegate if you want to get notified about different states of the STLocationRequestController
from stlocationrequest.
I know thats working fine. Im talking about the VC thats calling showLocationRequest(). I can't close it after showing LocationRequest
from stlocationrequest.
Got it!
So it might be the best to give me a code sample of how you present your ViewController and the code inside the ViewController to fix that problem.
But it seems thats it is not combined with the STLocationRequestController cause it's presenting itself modally where it got called and so it's not changing anything from ViewController where you call the STLocationRequestController. The first thing I would check is if your ViewController is presented modally and it's NOT presented by a show or push segue.
from stlocationrequest.
and then call
self.showLocationRequestController( setTitle: NSLocalizedString("REQUEST_LOCATION_TITLE", comment: "We need your location for some awesome features"), setAllowButtonTitle: NSLocalizedString("ALRIGHT", comment: "alright"), setNotNowButtonTitle: NSLocalizedString("NOT_NOW", comment: "not now"), setMapViewAlphaValue: 0.9, setBackgroundViewColor: UIColor.lightGrayColor(), setDelegate: self)
and then use
@IBAction func closeClicked(sender: AnyObject) { self.navigationController?.dismissViewControllerAnimated(true, completion: nil) }
to close the VC.
It's working fine if I don't call self.showLocationRequestController
and just call locationManager.requestWhenInUseAuthorization()
from stlocationrequest.
Do you have embedded your ViewController which will be presented modally as you written in a UINavigationController? If not please change your closeClicked function from
@IBAction func closeClicked(sender: AnyObject) {
self.navigationController?.dismissViewControllerAnimated(true, completion: nil)
}
to
@IBAction func closeClicked(sender: AnyObject) {
self.dismissViewControllerAnimated(true, completion: nil)
}
from stlocationrequest.
Yes I have
from stlocationrequest.
So I tried to reproduce your problem in a new Xcode project and there is no problem by presenting a viewcontroller modally and on that viewcontroller call self.showLocationRequestController() and dismiss it by a IBAction func with self.dismissViewControllerAnimated() with no UINavigationController and self.navigationController?.dismissViewControllerAnimated() with an UINavigationController.
Also you might tried to debug it and also before calling self.navigationController?.dismissViewControllerAnimated() print out your navigationController to check if its not nil print(self.navigationController)
So to give further help please provide the code inside your ViewController to have look what might causes that problem.
from stlocationrequest.
@LucasZL is your request still a current problem or did you found a solution for your problem?
from stlocationrequest.
Related Issues (13)
- Nice work. Swift 3 on the way? HOT 1
- using pod with Swift 3.0 project HOT 3
- Allow for Custom Locations HOT 2
- Cover other permissions HOT 1
- not working on IOS 11 HOT 3
- never show 3D scene once click Present STLocationRequestController -> Alright HOT 2
- Swift 4.2 Support? HOT 3
- UITapGestureRecognizer doesn't work HOT 1
- Memory leaks HOT 1
- Compilation errors in STLocationRequestController HOT 1
- The flyover part of is not working? HOT 1
- Use STLocationRequest in objective-c ViewController HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from stlocationrequest.