Giter VIP home page Giter VIP logo

Comments (8)

SvenTiigi avatar SvenTiigi commented on May 22, 2024

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.

LucasZL avatar LucasZL commented on May 22, 2024

I know thats working fine. Im talking about the VC thats calling showLocationRequest(). I can't close it after showing LocationRequest

from stlocationrequest.

SvenTiigi avatar SvenTiigi commented on May 22, 2024

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.

LucasZL avatar LucasZL commented on May 22, 2024

I present the VC modally:
screen shot 2016-06-04 at 17 17 30

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.

SvenTiigi avatar SvenTiigi commented on May 22, 2024

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.

LucasZL avatar LucasZL commented on May 22, 2024

Yes I have

from stlocationrequest.

SvenTiigi avatar SvenTiigi commented on May 22, 2024

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.
bildschirmfoto 2016-06-04 um 17 45 56
bildschirmfoto 2016-06-04 um 17 46 04
bildschirmfoto 2016-06-04 um 17 46 20

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.

SvenTiigi avatar SvenTiigi commented on May 22, 2024

@LucasZL is your request still a current problem or did you found a solution for your problem?

from stlocationrequest.

Related Issues (13)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.