GPS Event not refreshing - bug?

My app needs to use the GPS of the device so in my code (ios) if the user to “Deny” using the Location Services I give him a message saying that he needs it with a Retry button. 

The problem is that even if I remove the event for the location and re-add it, it doesn’t work. 

Here is my code:

 Any thoughts?

      local locationHandler = function( event )          -- Check for error (user may have turned off Location Services)             print("Inside location handler")             if bLocationFirstCheck then                 bLocationFirstCheck = false                 if event.errorCode then                     local function onRetry(event)                         if "clicked" == event.action then                             local function gpslistener( event )                                 Runtime:addEventListener( "location", locationHandler )                             end                             bLocationFirstCheck = true                             Runtime:removeEventListener( "location", locationHandler )                                 timer.performWithDelay( 100, gpslistener)                                end                     end                     local alert = native.showAlert( "Some text", "Application needs GPS, please enable and retry", {"Retry"}, onRetry )                 else -- It worked!                 end             end                      end         -- Activate location listener         Runtime:addEventListener( "location", locationHandler )