So I\'m new to mobile development but I\'m close to finishing up my first IOS application using HTML/CSS/JS and Cordova PhoneGap 3. I am trying to allow the user to provide
To create a Settings bundle that will work without having to muck in platforms/ios/, create a local plugin in your project.
./src/ios/plugin.xml
Application Settings
My Application's Default Settings
Proprietary
preferences, settings, default
https://github.com/
In Xcode, open ./src/ios
, and create a new Settings.bundle
./src/ios/Settings.bundle/Root.plist
PreferenceSpecifiers
Title
API Server
Type
PSGroupSpecifier
AutocapitalizationType
None
AutocorrectionType
No
DefaultValue
https://api.example.com
IsSecure
Key
name_preference
KeyboardType
Alphabet
Type
PSTextFieldSpecifier
StringsTable
Root
At the root of your project, run cordova plugin add ./src/ios
. It will say Installing "com.dataonline.dolores.settings" for ios
.
Use me.apla.cordova.app-preferences to load those settings from Javascript.
./src/client/preferences.js
function ApplicationPreferences(){
var _this = this;
this.server = window.location.origin;
document.addEventListener('deviceready', function(){
function loaded(server){_this.server = server;}
plugins.appPreferences.fetch(loaded, function(){}, 'api_server');
});
};
applicationPreferences = new ApplicationPreferences();
// Later..
$.get(applicationPreferences.server + "/api/data");
Edit Switched from two
s to one