Discussion Forums  >  Plugins, Customizing, Source Code

Replies: 2    Views: 32

juk
Aspiring developer
Profile
Posts: 29
Reg: Feb 16, 2014
York, UK
890
01/05/15 04:40 PM (9 years ago)

Re-querying Screen Data URL on each load of a Menu Simple screen

Hello. Been struggling with this for a while. I'm using a Menu Simple screen which uses the Screen Data URL to return child items from a PHP script on my server. I find that when you first browse to the screen in the iOS emulator it accesses the server and returns the correct result (a child item). However, when I then browse into the screen again it always returns the same result...and more quickly...suggesting it's not sending the query again. I've tried David's suggestion here (https://www.buzztouch.com/forum/thread.php?tid=E5E014B301E41E90A1D9D62&sortColumn=FT.id&sortUpDown=DESC&currentPage=1) but without success. Does anyone have any ideas to get this re-querying the server every time I load the screen? Thanks James
 
SmugWimp
Smugger than thou...
Profile
Posts: 6316
Reg: Nov 07, 2012
Tamuning, GU
81,410
like
01/05/15 11:47 PM (9 years ago)
If you're comfortable in the xcode environment, you might try this. It's not the most elegant way, but I think it should work. On or around line 145 you'll see where the code tests for a dataURL, and if true, it proceeds to an 'if' statement (if cached file exists, etc...) comment out the *entire* "if" section, approximately line 148-156. Then in lieu of that code, use this: [self downloadData]; and each time it goes through the loadData method, it will be 'forced' to load data from your dataURL. keep in mind if the device ever goes offline, you're in a pickle. Cheers! -- Smug
 
juk
Aspiring developer
Profile
Posts: 29
Reg: Feb 16, 2014
York, UK
890
like
01/06/15 01:13 PM (9 years ago)
What a star, thanks Smug! Seems to have done the trick. I'm not that comfortable in Xcode but things like this help me to progress. Take your point about going offline pickle but I think in the case of this app, it's more important to give the user the up-to-date information each time. The phone seems to give a bit of a warning about connectivity anyway. Cheers James
 

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.