Hi all,
I need some help, I don’t understand why my app isn’t generating location events on iOS, or even on the xcode simulator. It also doesn’t ask for user permission, but it should, right?
It works on Android and windows simulator (even throws 3 events at once on startup).
I hope it’s not some obvious configuration issue, because I’ve checked the Location documentation multiple times. But help me out.
Summarized code. You can see I tried lowering the threshold for the first event, but it didn’t change anything:
----------------------------------------------------------------------------- -- Location routine ----------------------------------------------------------------------------- -- Setup location hardware system.setLocationAccuracy( 10 ); system.setLocationThreshold( 1 ); -- first event only -- Debug text (global) debugBox = display.newText({ -- the args }); -- Location event handler local debugCount = 0; local netCount = 0; local function locationHandler( locEvent ) -- Increase threshold after first event system.setLocationThreshold( 100 ); debugCount = debugCount + 1; if ( debugCount == 1 ) then debugBox.text = debugBox.text .. "location event\n"; if ( locEvent.errorCode ) then debugBox.text = debugBox.text .. locEvent.errorMessage; end end -- If no error if ( not locEvent.errorCode ) then if ( debugCount == 1 ) then debugBox.text = debugBox.text .. "no error\n"; end -- some other stuff involving network requests end end -- Location event listener Runtime:addEventListener( "location", locationHandler );