Discussion Forums  >  Uncategorized

Replies: 18    Views: 511

MGoBlue
Apple Fan
Profile
Posts: 980
Reg: Jun 07, 2011
Gold River, CA
10,600
06/20/11 10:26 AM (14 years ago)

Force Refresh Issue

I've got a custom url set to load an html file from my server. In the Advanced Screen Properties, I've set Document Behavior to Force a Refresh. But it is not refreshing the content. It only refreshes if the app itself is refreshed. I would like it to force the refresh anytime someone selects the menu item. Can you help with this? I tried commenting out the conditional statement in BT_screen_customHTML.m like this: //if we are forcing a refresh each time... //if([[BT_strings getJsonPropertyValue:self.screenData.jsonVars:@forceRefresh:@] isEqualToString:@1]){ //if([[self dataURL] length] > 3){ [self setLocalFileName:@]; //} //} But that didn't work. Plus that would affect my other custom urls. Thoughts?
 
David @ buzztouch
buzztouch Evangelist
Profile
Posts: 6866
Reg: Jan 01, 2010
Monterey, CA
78,840
like
06/20/11 09:43 PM (14 years ago)
I see what you're doing, make sense. If you're using a Custom URL Screen the class file to tinker with is BT_screen_webView.m and not BT_screen_customHTML.m. Have a look at the viewWillAppear method in BT_sreenWebView.m and look for the little snipeet that checks to see if the screen has already loaded: if(didInit == 0){ didInit = 1; [self initLoad]; } When the screen loads it flag this to 1 so it doesn't reload each time the screen becomes visible. I think you want it too. So, something like this maybe: if(didInit == 0 || didInit == 1){ didInit = 1; [self initLoad]; } I just added the 'or didInit==1' part with the double pipes.
 
MGoBlue
Apple Fan
Profile
Posts: 980
Reg: Jun 07, 2011
Gold River, CA
10,600
like
06/21/11 12:00 AM (14 years ago)
That worked perfectly. Thank you!
 
ianJamesPiano
Code is Art
Profile
Posts: 2661
Reg: Feb 13, 2011
Palm Springs, C...
37,010
like
08/04/11 01:36 PM (14 years ago)
what about force refresh in the custom text screen? would like to force refresh custom text changes but only happens when closing then opening app...thanks!! i thought enabling force refresh in document behavior would auto refresh any changes made to the custom text screen? edit: so after editing the code in bt_screens_customhtml.m using the || didInit == 1 piece of code it seems as if the allow caching & force refresh is working as i would have expected in document behavior...this sound right? thanks!!
 
David @ buzztouch
buzztouch Evangelist
Profile
Posts: 6866
Reg: Jan 01, 2010
Monterey, CA
78,840
like
08/05/11 10:39 PM (14 years ago)
Hi Ian..long time no chat. Not sure what you're asking here. Maybe you're on to a bug we need to fix. If you got it to work, but only after altering the code, sounds like somethings wrong with the original code?
 
ianJamesPiano
Code is Art
Profile
Posts: 2661
Reg: Feb 13, 2011
Palm Springs, C...
37,010
like
08/06/11 01:45 AM (14 years ago)
Hi David, i made some custom text screens that i was gonna update every week and figured the force refresh in document behavior would update changes while the user still had the app open and came back to the custom text screen...this doesn't seem to be the case...one i messed with the code it works as i'd expected...hope this makes sense? Just got home from my gig...piano app worked like a charm for requests and sing alongs tonight...cheers!
 
David @ buzztouch
buzztouch Evangelist
Profile
Posts: 6866
Reg: Jan 01, 2010
Monterey, CA
78,840
like
08/06/11 01:50 AM (14 years ago)
Got it... looking ;-)
 
ianJamesPiano
Code is Art
Profile
Posts: 2661
Reg: Feb 13, 2011
Palm Springs, C...
37,010
like
08/08/11 02:51 PM (14 years ago)
Hi David, just wondering if u found anything with this issue...no rush...thanks!
 
David @ buzztouch
buzztouch Evangelist
Profile
Posts: 6866
Reg: Jan 01, 2010
Monterey, CA
78,840
like
08/09/11 01:14 AM (14 years ago)
Um, actually I did. Just updated the change log - fetch the source-code, compile, see if it works without any modifications. Also..for .PDF's and other docs you can now add an Email Document link ;-)
 
ianJamesPiano
Code is Art
Profile
Posts: 2661
Reg: Feb 13, 2011
Palm Springs, C...
37,010
like
08/09/11 01:30 AM (14 years ago)
Awesome! Do you think the mod to the source code i made is fine? don't really want to redo push notifications and other changes in my code but will if i have to...very cool about the email document link...cheers!!
 
David @ buzztouch
buzztouch Evangelist
Profile
Posts: 6866
Reg: Jan 01, 2010
Monterey, CA
78,840
like
08/09/11 01:45 AM (14 years ago)
The mode should be fine. No worries if it works. Next time you download a project you shouldn't have to re-do it though (because I fixed the force refresh thing).
 
ianJamesPiano
Code is Art
Profile
Posts: 2661
Reg: Feb 13, 2011
Palm Springs, C...
37,010
like
08/09/11 01:49 AM (14 years ago)
sweet thanks!!
 
ianJamesPiano
Code is Art
Profile
Posts: 2661
Reg: Feb 13, 2011
Palm Springs, C...
37,010
like
08/09/11 02:18 AM (14 years ago)
Actually i'm gonna man up and redownload the source-code...too many update goodies... cheers!!
 
ianJamesPiano
Code is Art
Profile
Posts: 2661
Reg: Feb 13, 2011
Palm Springs, C...
37,010
like
08/09/11 12:22 PM (14 years ago)
Hi David, Force Refresh is working great,,,thanks for all your hard work!
 
David @ buzztouch
buzztouch Evangelist
Profile
Posts: 6866
Reg: Jan 01, 2010
Monterey, CA
78,840
like
08/09/11 06:05 PM (14 years ago)
Funny too cuz' I broke something else while fixing that! Not sure if you say the posts from this morning, bunch of broken web-views not loading. Had a little triage for breakfast! Hee hee.
 
ianJamesPiano
Code is Art
Profile
Posts: 2661
Reg: Feb 13, 2011
Palm Springs, C...
37,010
like
08/09/11 06:11 PM (14 years ago)
oops!! does that mean i should redownload source code again? good ole triage
 
David @ buzztouch
buzztouch Evangelist
Profile
Posts: 6866
Reg: Jan 01, 2010
Monterey, CA
78,840
like
08/09/11 06:33 PM (14 years ago)
If you havn't since this morning - yup. I know you change things after downloads so my fingers are crossed that you have an elegant solution to integreate you fancy-code into each new download. Scared that you don't and it sucks to re-paste everything?
 
ianJamesPiano
Code is Art
Profile
Posts: 2661
Reg: Feb 13, 2011
Palm Springs, C...
37,010
like
08/09/11 07:02 PM (14 years ago)
i actually downloaded the code around noon today so i should be all good (looks like you had the code fixed around 10am)...everything seems to be working fine...yes i have my quick fixes all ready to go...probably takes me 5 min. to get all coding on my end updated
 
Koppenhofer
Lost but trying
Profile
Posts: 20
Reg: Sep 28, 2011
Gilbert, AZ
200
like
11/04/11 12:40 PM (14 years ago)
I know this thread is way old but I'm having the same problem and the fix mentioned above is not working. I have both, Custom URL and Custom HTML screens that I want to force the refresh on every time they get opened but the 'force refresh' in the Document Behavior section does not do the trick. I went into both (BT_screen_webView.m and BT_screen_customHTML.m) and changed this: if(didInit == 0){ didInit = 1; [self initLoad]; } To this: if(didInit == 0 || didInit == 1){ didInit = 1; [self initLoad]; } But still nothing. The only way to get the CustomHTML or the CustomURL to refresh is if I hit the refresh button that was provided by the 'Show Browser Refresh Button' in the Document Behavior. Any suggestions would be greatly appreciated, thanks!!!
 

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.