Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-17641] iOS8: Add UIApplicationOpenSettingsURLString Support

GitHub Issuen/a
TypeImprovement
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2014-09-15T16:10:50.000+0000
Affected Version/sn/a
Fix Version/sRelease 3.4.0, Release 3.5.0
ComponentsiOS
Labelsios8
ReporterBen Bahrenburg
AssigneeJon Alter
Created2014-09-03T23:30:39.000+0000
Updated2015-05-06T20:18:27.000+0000

Description

Add a property to return the application setting URL on iOS 8 so that we can use Ti.Platform.openURL to launch directly into that screen. For example:
	var settingsURL = Ti.App.iOS.ApplicationOpenSettingsURL;
	if(settingsURL != undefined) {
		if(Ti.Platform.canOpenURL(settingsURL)) {
			Ti.Platform.openURL(settingsURL);	
		} else {
			alert('cannot open URL');
		}		
	}

Comments

  1. Ben Bahrenburg 2014-09-04

    Added pull request https://github.com/appcelerator/titanium_mobile/pull/6017 Ingo mentioned AppC is now taking iOS8 PR. This ticket was created in associated with PR 6017.
  2. Ingo Muschenetz 2014-09-04

    [~mpmiranda], for iOS 8 tickets, add a label of "ios8" and make sure the summary _starts_ with iOS8 (no spaces)
  3. Ben Bahrenburg 2014-09-08

    How to test: 1. Using a Ti SDK with this PR included create a Titanium app. 2. Select iOS8 as the target. 3. Copy the below into the app.js
       var win = Titanium.UI.createWindow({  
           backgroundColor:'#fff',layout:'vertical'
       });
       
       var btnSettingsURL = Titanium.UI.createButton({
           title:'Settings URL Test', left:25,right:25, top:80
       });
       win.add(btnSettingsURL);
       
       btnSettingsURL.addEventListener('click',function(d){
       	var settingsURL = Ti.App.iOS.ApplicationOpenSettingsURL;
       	if(settingsURL!=undefined){
       	    if(Ti.Platform.canOpenURL(settingsURL)){
       	        Ti.Platform.openURL(settingsURL);
       	    }else{
       	    	alert('cannot open URL');
       	 	}
       	}else{
       		alert('undefined results for ApplicationOpenSettingsURL are you using iOS7 or lower?');
       	}
       });
       
       win.open();
       
    4. Press the button, you should then be taken to the privacy settings for your app 5. Close simulator or remove app from device 6. Update your Titanium test project to target iOS7 7. Launch in simulator or push to device 8. Press the test button, you should now get a message stating that ApplicationOpenSettingsURL is undefined. This is due to iOS7 not supporting this property.
  4. Ingo Muschenetz 2014-09-09

    Can you take a look?
  5. Jon Alter 2014-09-11

    PR master: https://github.com/appcelerator/titanium_mobile/pull/6060 PR 3_4_X: https://github.com/appcelerator/titanium_mobile/pull/6061
  6. Satyam Sekhri 2014-09-15

    Using Ben's code, the settingsURL is undefined even for iOS SDK 8 target. Tested On: SDK: 3.4.0.v20140913174915 Studio: 3.4.0.201409131030 CLI: 3.4.0-rc3 Alloy: 1.5.0-rc2 Xcode: Xcode 6 GM seed Device: iPhone 5s (v8.0 GM)
  7. Chee Kiat Ng 2014-09-15

    Ben's sample code has to be updated, Application should be small 'a' in Ti.App.iOS.applicationOpenSettingsURL. Please use this instead.
       var win = Titanium.UI.createWindow({  
           backgroundColor:'#fff',layout:'vertical'
       });
       
       var btnSettingsURL = Titanium.UI.createButton({
           title:'Settings URL Test', left:25,right:25, top:80
       });
       win.add(btnSettingsURL);
       
       btnSettingsURL.addEventListener('click',function(d){
       	var settingsURL = Ti.App.iOS.applicationOpenSettingsURL;
       	if(settingsURL!=undefined){
       	    if(Ti.Platform.canOpenURL(settingsURL)){
       	        Ti.Platform.openURL(settingsURL);
       	    }else{
       	    	alert('cannot open URL');
       	 	}
       	}else{
       		alert('undefined results for applicationOpenSettingsURL are you using iOS7 or lower?');
       	}
       });
       
       win.open();
       
  8. Satyam Sekhri 2014-09-15

    The Ti.App.iOS.ApplicationOpenSettingsURL works as expected. Tested using the updated code and instruction mentioned by Ben. Tested On: SDK: 3.4.0.v20140913174915 Studio: 3.4.0.201409131030 CLI: 3.4.0-rc3 Alloy: 1.5.0-rc2 Xcode: Xcode 6 GM seed
  9. Lucas Alves 2015-05-06

    Hello, Using the provided code enables me to open the APP'S SETTINGS - just like documentation says: _Returns a URL to open the app's settings._ The problem is that this is not the most common behavior if you're trying to turn LOCATION SERVICES back on, for example, using the current method you'll need to go back from the App's settings into -> Select Privacy -> Select Location services. This is horrible from the user's point of view, because he/she might try to enable Location services from within the app's settings, but if it was turned off from the privacy page, iOS won't allow the user to change it back on (hence the above path is needed). That being said, pretty much all the apps that depend on Location Services (Hotel Tonight, Foursquare, Dojo, etc.) are able to launch the Location Services page (Child of Privacy) DIRECTLY. My question is: Is it possible to open the settings page directly with this String? If Not, shouldn't there be another string for it? Thanks a lot - I know it's a little out of ordinary to ask questions here, but this might also be a bug, since from a quick research the apps used the same exact string for a different behavior in Objective-C.

JSON Source