Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-19444] iOS9: Ti.Geolocation.forwardGeocoder does not work any more

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2015-09-02T04:17:12.000+0000
Affected Version/sn/a
Fix Version/sRelease 5.0.0
ComponentsiOS
LabelsiOS9
ReporterShuo Liang
AssigneeHans Knöchel
Created2015-09-01T08:17:23.000+0000
Updated2015-10-06T23:23:46.000+0000

Description

Problem

When attempting to use Ti.Geolocation.forwardGeocoder in iOS 9 it never completes. On iOS 8 this works just fine.

Reproduce:

1. Simply run the following code
Ti.API.error('fwdGeocode'); 
Ti.Geolocation.forwardGeocoder('94111', function(e) { 
Ti.API.error('fwdGeocode resp'); 
Ti.API.error('appcel resp:' + JSON.stringify(e)); 
});

Expect Result:

Works well in 3.5.1 SDK, the output is:
[ERROR] : fwdGeocode resp 
[ERROR] : appcel resp:{"code":0,"longitude":"-122.400399983355","latitude":"37.7973885857828","accuracy":"1","success":true} 

Actual Result:

The latest beta SDK, the output is:
[ERROR] : fwdGeocode resp

Comments

  1. Hans Knöchel 2015-09-01

    The error is happening because of the iOS9 app transport security " App Transport Security has blocked a cleartext HTTP (http://) resource load since it is insecure. Temporary exceptions can be configured via your app's Info.plist file.". The calling API is "http://api.appcelerator.net/p/v1/geo". Two possible ways to fix: 1. Also wildcard http:// calls on the appcelerator.com domain 2. Update the URL in GeolocationModule.m to https:// [~cng] [~cbarber], thoughts?
  2. Chris Barber 2015-09-01

    First off, ATS is off by default. You have to opt-in by manually adding the NSAppTransportSecurity to the Info.plist/tiapp.xml. If they opt-in, then we whitelist all appcelerator.com subdomains. However, I noticed that we default NSExceptionAllowsInsecureHTTPLoads to false. I sorta think we should leave it false as we should never connect to a non-ssl appcelerator.com site. But if someone had a webview and went to appcelerator.com over http, it would fail, so I could be convinced that it should be true by default. Either way, we should definitely update GeolocationModule.m to use https. Perhaps grep the code for any other requests like this.
  3. Hans Knöchel 2015-09-01

    Fixed it for iOS9, but neither forwardGeocoder nor reverseGeocoder are currently working, since the success delegate onLoad is not called any more. It seems to be a problem with the latest commits made on the APSHTTPClient. Will hold this until [~cng] is back.
  4. Hans Knöchel 2015-09-02

    PR of [~cng] (https://github.com/appcelerator/titanium_mobile/pull/7114) tested & merged. Thank you! [~sliang] can you confirm using the latest master?
  5. Chee Kiat Ng 2015-09-02

    backport PR: https://github.com/appcelerator/titanium_mobile/pull/7115
  6. Shuo Liang 2015-09-02

    Ok, Confirmed. Waiting for customer's verify.
  7. Harry Bryant 2015-10-06

    Verified as fixed, ran the code from step 1. and built to device, received following:
       [ERROR] :  fwdGeocode resp
       [ERROR] :  appcel resp:{"success":true,"code":0,"latitude":"37.7974","accuracy":"1","longitude":"-122.4001"}
       
    OSX El Capitan 10.11 iOS 9 Studio: 4.3.1.201509302304 Ti SDK: 5.0.2.GA Appc NPM: 4.2.0 Appc CLI: 5.0.2

JSON Source