Discussion Forums  >  Plugins, Customizing, Source Code

Replies: 12    Views: 47

@rob
Code is Art
Profile
Posts: 115
Reg: Dec 10, 2013
Alabama
8,800
01/12/14 08:24 PM (11 years ago)

(Solved) Problem with bt_screen_wordDoc custom url data

Hello- I have a custom PHP script that queries my DB and builds a menu in bt_screen_menuSimple. The menu is a list of Microsoft Word files (.doc). If I hardcode the url into bt_screen_wordDoc via the control panel, it loads fine but sending the same url to bt_screen_wordDoc from the bt_screen_menuSimple does not load. I use the same exact procedure to build a menu of MP3s and then I send them to bta_audiostreamer and it works perfectly so I feel confident in the process, just not sure why it isn't working with bt_screen_wordDoc. Here is a snippet of my PHP output that builds the menu, does anyone see anything that could be causing issues? { "childItems":[ { "itemId":"169", "itemType":"Bt_menuItem", "titleText”:”Doc title from my database”, "loadScreenObject":{"loadScreenWithItemId":"7E7F6AE639517F3A1FFA76C", "itemId":"169", "itemType":"BT_screen_wordDoc", "navBarTitleText”:”My Word Doc Title”, "dataUrl":"http://www.myserver.com/myDocument.doc"} } ] }
 
GoNorthWest
buzztouch Evangelist
Profile
Posts: 8197
Reg: Jun 24, 2011
Oro Valley, AZ
1,000,000
like
01/12/14 08:45 PM (11 years ago)
Hello, For this I would be looking in the debug console or LogCat to see if it's sending the URL I think it is. That would be my first step in debugging this. Mark
 
SmugWimp
Smugger than thou...
Profile
Posts: 6316
Reg: Nov 07, 2012
Tamuning, GU
81,410
like
01/12/14 10:03 PM (11 years ago)
Along with what Mark says (always listen to what Mark says…) I've noticed a couple of things… maybe they mean something, it depends on the 'example'. 1) It should be 'BT_menuItem'. Lower case 't' will not work. Syntax… 2) With loadScreenObject, you don't need to tell it 'loadScreenWithItemId'; you use it 'in place' of loadScreenWithId. You don't need that; take it out. 3) I get JSON errors with your sample, despite the fact that it 'looks' valid. The culprit turned out to be an illegal quote mark. Look at your example above; notice the quote mark surrounding your first 'itemId'. THAT is a correct quote mark. Now look at the quote mark at the END of 'titleText' and before 'Doc from my database'. Notice the slightly visual difference? that is an illegal quote, and will cause Json errors. Be "really really really" concious of your syntax, especially working with Json. It's all unforgiving, and a little error will stop your app just as quickly as bad code. Use Jsonlint, and when you get errors, reduce your data to the minimum needed to get a valid response, then add it line by line until the error occurs; you can discern the issue easier that way. Cheers! -- Smug Edit: My 'clean' version of your sample above would look like this: { "childItems": [ { "itemId": "169", "itemType":"BT_menuItem", "titleText": "Doc Title From Database", "loadScreenObject": { "itemId": "169", "itemType": "BT_screen_wordDoc", "navBarTitleText": "My Word Doc Title", "dataUrl": "http: //www.myserver.com/myDocument.doc" } } ] }
 
GoNorthWest
buzztouch Evangelist
Profile
Posts: 8197
Reg: Jun 24, 2011
Oro Valley, AZ
1,000,000
like
01/12/14 11:19 PM (11 years ago)
Nice catch, Smug! Always, always listen to Smug! JSON errors will get you more times than you can imaging. Hopefully this turns out to be the issue. Mark
 
@rob
Code is Art
Profile
Posts: 115
Reg: Dec 10, 2013
Alabama
8,800
like
01/13/14 08:35 AM (11 years ago)
Thanks Mark and Smug, I will follow up after I test Smug's catch on the quote marks. I come from the Unix world, where when you have an error "its all about the file permissions" I am finding in the Coding world when you have an error "its all about the syntax" :)
 
@rob
Code is Art
Profile
Posts: 115
Reg: Dec 10, 2013
Alabama
8,800
like
01/13/14 10:38 AM (11 years ago)
well, no luck... Smug, I did change BT to Bt but it turns out that wasn't causing any issues (I found that I had it wrong on my other mp3 screen, and it is still working as its supposed to in that script) I also removed LoadScreenWithID, still didn't work And lastly, I checked my script and did not see any quotation mark format errors, and then it occurred to me that I actually edited the output (just to sanitise out my personal data) before I posted the output here and thats what re-formatted the quote marks, they are actually be output correctly from my script. Here is a true example: I will actually leave this in the true format that the script outputs with no line breaks or anything: {"childItems":[{"itemId":"169","itemType":"BT_menuItem","titleText":"2014 - The Year of Promise-Jan 05, 2014","loadScreenObject":{"itemNickname":"WordDoc","itemId":"169","itemType":"BT_screen_wordDoc","navBarTitleText":"","dataUrl":"http://www.myserver.org/sermons/2014 - The Year of Promise.doc"}}]}
 
GoNorthWest
buzztouch Evangelist
Profile
Posts: 8197
Reg: Jun 24, 2011
Oro Valley, AZ
1,000,000
like
01/13/14 10:42 AM (11 years ago)
Have you looked at the debug output to see what's going on at the time you try to load that document? The filename concerns me - "2014 - The Year of Promise.doc". That's a lot of spaces which both Android and iOS don't seem overly fond of. Mark
 
@rob
Code is Art
Profile
Posts: 115
Reg: Dec 10, 2013
Alabama
8,800
like
01/13/14 10:45 AM (11 years ago)
Mark, I did think about the file name as the possible culprit so I tested it by removing all the spaces in a test filename in my DB, still didnt work....but here is my debug output, I never see any reference to the url be passed: Notice that I added "itemNickname" to my "loadScreenObject", thats the only thing I saw in the debug about that the debuggers was complaining about. 2014-01-13 11:40:20.126 wvcnew[3862:70b] BT_screen_menuButtons: menuItemTap 2014-01-13 11:40:20.328 wvcnew[3862:70b] BT_application: getScreenDataByItemId 4A96DBD026A49E707F0F089 2014-01-13 11:40:20.328 wvcnew[3862:70b] BT_application: screenType is BT_screen_menuListSimple for screen with nickname: "Outline" and itemId: 4A96DBD026A49E707F0F089 2014-01-13 11:40:20.328 wvcnew[3862:70b] BT_screen_menuButtons: handleTapToLoadScreen (super) loading nickname: "Outline" itemId: 4A96DBD026A49E707F0F089 itemType: BT_screen_menuListSimple 2014-01-13 11:40:20.329 wvcnew[3862:70b] BT_application: getViewControllerForScreen nickname: "Outline" itemId: 4A96DBD026A49E707F0F089 type: BT_screen_menuListSimple 2014-01-13 11:40:20.329 wvcnew[3862:70b] BT_screen_menuListSimple: INIT 2014-01-13 11:40:20.329 wvcnew[3862:70b] BT_navController: pushViewController 2014-01-13 11:40:20.330 wvcnew[3862:70b] BT_screen_menuListSimple: viewDidLoad 2014-01-13 11:40:20.330 wvcnew[3862:70b] BT_screen_menuListSimple: viewDidLoad (super) 2014-01-13 11:40:20.330 wvcnew[3862:70b] BT_viewUtilities: getTableViewForScreen with nickname: "Outline" and itemId: 4A96DBD026A49E707F0F089 and type: BT_screen_menuListSimple 2014-01-13 11:40:20.331 wvcnew[3862:70b] BT_screen_menuListSimple: viewWillAppear (super) 2014-01-13 11:40:20.331 wvcnew[3862:70b] BT_screen_menuListSimple: configureNavBar (super) for screen with itemId: 4A96DBD026A49E707F0F089 2014-01-13 11:40:20.331 wvcnew[3862:70b] BT_viewUtilities: getNavBarBackgroundColorForScreen: Screen "Outline" color: #000000 2014-01-13 11:40:20.332 wvcnew[3862:70b] BT_screen_menuListSimple: configureBackground (super) for screen with itemId 4A96DBD026A49E707F0F089: 2014-01-13 11:40:20.332 wvcnew[3862:70b] BT_background_view: updateProperties (color and image) for screen with itemId: 4A96DBD026A49E707F0F089: 2014-01-13 11:40:20.332 wvcnew[3862:70b] BT_fileManager: File does exist in Xcode bundle: "blank.png" 2014-01-13 11:40:20.332 wvcnew[3862:70b] BT_background_view: "blank.png" exists in Xcode bundle - not downloading. 2014-01-13 11:40:20.333 wvcnew[3862:70b] BT_background_view: setImage 2014-01-13 11:40:20.333 wvcnew[3862:70b] BT_screen_menuListSimple: viewWillAppear 2014-01-13 11:40:20.434 wvcnew[3862:70b] BT_screen_menuListSimple: loadData 2014-01-13 11:40:20.435 wvcnew[3862:70b] BT_fileManager: File does exist in cached directory: "screenData_4A96DBD026A49E707F0F089.txt" 2014-01-13 11:40:20.435 wvcnew[3862:70b] BT_screen_menuListSimple: parsing cached version of screen data 2014-01-13 11:40:20.435 wvcnew[3862:70b] BT_fileManager: readTextFileFromCacheWithEncoding: "screenData_4A96DBD026A49E707F0F089.txt" encoding: -1 2014-01-13 11:40:20.437 wvcnew[3862:70b] BT_screen_menuListSimple: parseScreenData 2014-01-13 11:40:20.437 wvcnew[3862:70b] BT_screen_menuListSimple: layoutScreen 2014-01-13 11:40:23.974 wvcnew[3862:70b] BT_screen_menuListSimple: didSelectRowAtIndexPath: Selected Row: 0 2014-01-13 11:40:23.974 wvcnew[3862:70b] BT_screen_menuListSimple: handleTapToLoadScreen (super) loading nickname: "WordDoc" itemId: 169 itemType: BT_screen_wordDoc 2014-01-13 11:40:23.974 wvcnew[3862:70b] BT_application: getViewControllerForScreen nickname: "WordDoc" itemId: 169 type: BT_screen_wordDoc 2014-01-13 11:40:23.975 wvcnew[3862:70b] BT_screen_wordDoc: INIT 2014-01-13 11:40:23.975 wvcnew[3862:70b] BT_navController: pushViewController 2014-01-13 11:40:23.975 wvcnew[3862:70b] BT_screen_wordDoc: viewDidLoad 2014-01-13 11:40:23.976 wvcnew[3862:70b] BT_screen_wordDoc: viewDidLoad (super) 2014-01-13 11:40:23.976 wvcnew[3862:70b] BT_viewUtilities: getWebNavBarForScreen with nickname: "WordDoc" and itemId: 169 and type: BT_screen_wordDoc 2014-01-13 11:40:23.978 wvcnew[3862:70b] BT_screen_wordDoc: viewWillAppear (super) 2014-01-13 11:40:23.978 wvcnew[3862:70b] BT_screen_wordDoc: configureNavBar (super) for screen with itemId: 169 2014-01-13 11:40:23.979 wvcnew[3862:70b] BT_viewUtilities: getNavBarBackgroundColorForScreen: Screen "WordDoc" color: #000000 2014-01-13 11:40:23.979 wvcnew[3862:70b] BT_screen_wordDoc: configureBackground (super) for screen with itemId 169: 2014-01-13 11:40:23.979 wvcnew[3862:70b] BT_background_view: updateProperties (color and image) for screen with itemId: 169: 2014-01-13 11:40:23.979 wvcnew[3862:70b] BT_fileManager: File does exist in Xcode bundle: "blank.png" 2014-01-13 11:40:23.980 wvcnew[3862:70b] BT_background_view: "blank.png" exists in Xcode bundle - not downloading. 2014-01-13 11:40:23.980 wvcnew[3862:70b] BT_background_view: setImage 2014-01-13 11:40:23.980 wvcnew[3862:70b] BT_screen_wordDoc: viewWillAppear
 
GoNorthWest
buzztouch Evangelist
Profile
Posts: 8197
Reg: Jun 24, 2011
Oro Valley, AZ
1,000,000
like
01/13/14 10:48 AM (11 years ago)
Hmm. That's all inconclusive. I would have expected some debug statements about it hitting a particular URL to download the document. I'll have to experiment a bit tonight when I get home, just to be sure it works as I expect. Mark
 
@rob
Code is Art
Profile
Posts: 115
Reg: Dec 10, 2013
Alabama
8,800
like
01/13/14 10:55 AM (11 years ago)
Well I just found it.....I took one last look at the config file for BT_screen_wordDoc to double check the syntax of the JASON it was looking for and it jumped right out at me this time: The correct syntax was "dataURL" but my script was outputting "dataUrl" Thanks Mark and Smug for pushing me to look harder at my sytax!!
 
@rob
Code is Art
Profile
Posts: 115
Reg: Dec 10, 2013
Alabama
8,800
like
01/13/14 10:57 AM (11 years ago)
I just love this community of folks that are willing to help each other as we all learn together....great stuff!!
 
GoNorthWest
buzztouch Evangelist
Profile
Posts: 8197
Reg: Jun 24, 2011
Oro Valley, AZ
1,000,000
like
01/13/14 11:06 AM (11 years ago)
Rock on! Way to hang in there and figure it out! Mark
 
SmugWimp
Smugger than thou...
Profile
Posts: 6316
Reg: Nov 07, 2012
Tamuning, GU
81,410
like
01/13/14 03:54 PM (11 years ago)
Always nice to wake up to a solved issue. Glad you got it going! Cheers! -- Smug
 

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.