locationHandler eventlistener not triggered on IOS 8.1.3

I’m using this code:

locationHandler = function(event)tell("locationHandler") -- ... end function readGPS() tell("readGPS") if SIM then tell("readGPS sim") USERLAT=60 USERLON=15 slat="60" slon="15" else tell("readGPS not sim ok") Runtime:addEventListener( "location", locationHandler ) end end

The addEventListener line in readGPS is reached, but the eventlistener is never triggered. The app doesn’t ask permission to use GPS after a reinstall, and there are no settings to change in the phone’s Settings. 

  • Iphone 6, IOS 8.1.3

  • Latest Corona (2014.2511)

I was thinking I have to add some line to build settings to go into the info.plist for the app?

The same code works fine in iOS 7 and on Android.

The code tag messed up tabs and newlines in the text, so that you don’t think the reason is some missing space between (event) and tell()

Here’s the generated info.plist, if it helps.

Feb 25 15:14:36.770: Created XCENT: /var/folders/y2/8sbxz1p150s9ch6gv2\_zrgtc0000gn/T/CLtmpOgmLj3/entitlements.xcent Feb 25 15:14:36.801: \<?xml version="1.0" encoding="UTF-8"?\> Feb 25 15:14:36.801: \<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"\> Feb 25 15:14:36.801: \<plist version="1.0"\> Feb 25 15:14:36.801: \<dict\> Feb 25 15:14:36.801: \<key\>application-identifier\</key\> Feb 25 15:14:36.801: \<string\>36S62N2NT6.se.avia.shoppingtranas\</string\> Feb 25 15:14:36.801: \<key\>keychain-access-groups\</key\> Feb 25 15:14:36.801: \<array\> Feb 25 15:14:36.801: \<string\>36S62N2NT6.se.avia.shoppingtranas\</string\> Feb 25 15:14:36.801: \</array\> Feb 25 15:14:36.801: \<key\>get-task-allow\</key\> Feb 25 15:14:36.802: \<true/\> \<key\>aps-environment\</key\> Feb 25 15:14:36.802: &nbsp; &nbsp; \<string\>development\</string\> Feb 25 15:14:36.802: \</dict\> Feb 25 15:14:36.802: \</plist\> Feb 25 15:14:36.812: Creating Info.plist... Feb 25 15:14:36.893: &nbsp; &nbsp; adding extra plist setting UIStatusBarHidden: true Feb 25 15:14:36.893: &nbsp; &nbsp; adding extra plist setting UIApplicationExitsOnSuspend: true Feb 25 15:14:36.893: &nbsp; &nbsp; adding extra plist setting UIPrerenderedIcon: true Feb 25 15:14:36.893: &nbsp; &nbsp; adding extra plist setting CFBundleIdentifier: se.avia.shoppingtranas Feb 25 15:14:36.893: &nbsp; &nbsp; adding extra plist setting CFBundleDisplayName: Shopping Tranås Feb 25 15:14:36.893: &nbsp; &nbsp; adding extra plist setting CFBundleShortVersionString: 1.2

No compile errors or warnings.

Sorry for double(triple!!)-posting, but I’m wary of editing since before, this has removed the code tag and causing a messy post which can’t be restored. Maybe this is fixed now?

I wanted to add that the previous version which is on App Store works, and the build.settings file hasn’t been changed.

Edit: same symptom on an Iphone 5 running IOS 8.3.1. “Unfortunately”, this phone has also had the previous app version installed (where the Location Services switch for the app is present in Settings, unlike the new version).

I will try the GPS example from the Corona install and report back.

The apps are installed with latest XCode 6.1.1 on latest OS X 10.10.2.

Edit: The GPS example causes the “allow GPS” to pop up, so I’ll assume there’s some difference in Lua interpreters between the various IOS versions and try finding the error in the XCode console on the affected device.

It was NSLocationWhenInUseUsageDescription. Maybe add to documentation and issue a compiler warning if it’s possible to detect? Then you’d be one up on Apple :wink:

The code tag messed up tabs and newlines in the text, so that you don’t think the reason is some missing space between (event) and tell()

Here’s the generated info.plist, if it helps.

Feb 25 15:14:36.770: Created XCENT: /var/folders/y2/8sbxz1p150s9ch6gv2\_zrgtc0000gn/T/CLtmpOgmLj3/entitlements.xcent Feb 25 15:14:36.801: \<?xml version="1.0" encoding="UTF-8"?\> Feb 25 15:14:36.801: \<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"\> Feb 25 15:14:36.801: \<plist version="1.0"\> Feb 25 15:14:36.801: \<dict\> Feb 25 15:14:36.801: \<key\>application-identifier\</key\> Feb 25 15:14:36.801: \<string\>36S62N2NT6.se.avia.shoppingtranas\</string\> Feb 25 15:14:36.801: \<key\>keychain-access-groups\</key\> Feb 25 15:14:36.801: \<array\> Feb 25 15:14:36.801: \<string\>36S62N2NT6.se.avia.shoppingtranas\</string\> Feb 25 15:14:36.801: \</array\> Feb 25 15:14:36.801: \<key\>get-task-allow\</key\> Feb 25 15:14:36.802: \<true/\> \<key\>aps-environment\</key\> Feb 25 15:14:36.802: &nbsp; &nbsp; \<string\>development\</string\> Feb 25 15:14:36.802: \</dict\> Feb 25 15:14:36.802: \</plist\> Feb 25 15:14:36.812: Creating Info.plist... Feb 25 15:14:36.893: &nbsp; &nbsp; adding extra plist setting UIStatusBarHidden: true Feb 25 15:14:36.893: &nbsp; &nbsp; adding extra plist setting UIApplicationExitsOnSuspend: true Feb 25 15:14:36.893: &nbsp; &nbsp; adding extra plist setting UIPrerenderedIcon: true Feb 25 15:14:36.893: &nbsp; &nbsp; adding extra plist setting CFBundleIdentifier: se.avia.shoppingtranas Feb 25 15:14:36.893: &nbsp; &nbsp; adding extra plist setting CFBundleDisplayName: Shopping Tranås Feb 25 15:14:36.893: &nbsp; &nbsp; adding extra plist setting CFBundleShortVersionString: 1.2

No compile errors or warnings.

Sorry for double(triple!!)-posting, but I’m wary of editing since before, this has removed the code tag and causing a messy post which can’t be restored. Maybe this is fixed now?

I wanted to add that the previous version which is on App Store works, and the build.settings file hasn’t been changed.

Edit: same symptom on an Iphone 5 running IOS 8.3.1. “Unfortunately”, this phone has also had the previous app version installed (where the Location Services switch for the app is present in Settings, unlike the new version).

I will try the GPS example from the Corona install and report back.

The apps are installed with latest XCode 6.1.1 on latest OS X 10.10.2.

Edit: The GPS example causes the “allow GPS” to pop up, so I’ll assume there’s some difference in Lua interpreters between the various IOS versions and try finding the error in the XCode console on the affected device.

It was NSLocationWhenInUseUsageDescription. Maybe add to documentation and issue a compiler warning if it’s possible to detect? Then you’d be one up on Apple :wink: