i'm working on ios hybrid app cordova , backbone.js. stored url in appdelegate.m
file using nsuserdefaults
. want import url in backbone.js file instead of hard coded url in file.
here's sample code that.
native code used in appdelegate.m
nsuserdefaults *defaults = [nsuserdefaults standarduserdefaults]; // initial launch url console app policy nsdictionary *apppolicydictionary =[gdlibrary getapplicationpolicy]; nsstring *serviceurlfrompolicy =[[apppolicydictionary objectforkey:@"loginurl"]objectforkey:@"loginurl"]; [defaults setobject:serviceurlfrompolicy forkey:@"loginurl"]; [defaults synchronize];
how declared url in backbone.js
define(["jquery", "backbone"], function($, backbone) { var appconfig = { defaults: { env: "dev" }, session_timeout: 30 * 60, // in seconds dev: { url: 'https://www.myurl.com' } }
Comments
Post a Comment