Discussion Forums  >  Plugins, Customizing, Source Code

Replies: 2    Views: 184

Veteran developer
Posts: 110
Reg: Oct 19, 2013
Fourm StarFourm Star
02/02/18 06:41 AM (5 years ago)

Live/Design Mode work-around?

There are some error reports on the Live/Design mode feature not working correctly. Smug had proposed a solution in https://www.buzztouch.com/forum/thread.php?tid=D406249C46561CC4ABDF570&command=isSearching&currentPage=1&topicTitle=Live&createdBy=&repliedBy=&minViews=-1&maxViews=-1&minReplies=-1&maxReplies=-1&forumCategory= where you append the "&currentMode=live" snippet in the 'configuration data URL' field in your control panel (Core properties) and set your app to "Live" in XCode. Also, this discussion shows that the JSON data of your app is available in two versions (Design and Live), as expected. When testing the Live mode with one of my apps I noticed that the first "refresh" leads to the correct app data (no unpublished data are shown). However, after the second "refresh" the current content of the control panel (with unpublished changes) is shown. When looking closer into the source code and into the JSON data you see that the "Configuration Data URL" (as modified above with "&currentMode=live") does not make it to the Live JSON data... at least in my self hosted environment. So if I make a correction in my configuration file in Xcode it uses the correct live-URL for the first refresh, but after that update the configuration points back to the design-URL. So... my work-around is 1) I leave the Core properties unchanged... 2) In BT_loading.m I add some code after Line 158: useDataURL = [appCoreProperties.jsonVars objectForKey:@"dataURL"]; This is the code to add: if ([appDelegate.currentMode isEqualToString:@"Live"]) { if ([useDataURL rangeOfString:@"&currentMode=live"].location == NSNotFound) { useDataURL = [useDataURL stringByAppendingString:@"&currentMode=live"]; } } What it does... is just corrects the configuration URL and adds the "&currentMode=live" part in code. And it does this only if this suffix is not present anyway (in case someone would correct the JSON data in the Buzztouch software...). Best wishes – happy coding Thomas
Code is Art
Posts: 1025
Reg: Jun 07, 2012
Fourm StarFourm StarFourm Star
02/02/18 07:57 AM (5 years ago)
Thanks for this. I’m updating an app soon and was wondering if I was going to need to mess with the code for live and design mode.
Calypso Kid
Aspiring developer
Posts: 780
Reg: Mar 09, 2012
Upstate New Yor...
Fourm StarFourm StarFourm Star
02/03/18 09:47 AM (5 years ago)
Nice! Thank you Thomas. Dave

Login + Screen Name Required to Post

pointerLogin to participate so you can start earning points. Once you're logged in (and have a screen name entered in your profile), you can subscribe to topics, follow users, and start learning how to make apps like the pros.