Originally reported here: http://drupal.org/node/1030334#comment-4211048
When I try to browse Content (section) > Content (vertical tab), the app quits unexpectedly EVERY time.
@anavarre can you be a bit more precise, please. I can't reproduce for now.
From the main screen what does crash:
- Content
- or inside Content switching between Published and Not published
- Browse site
Can you tell me: iOS version, iPhone/iPodTouch version (3, 3G, 3Gs, 4, iPad, etc.)
Does your device still have free space?
Thanks,
Jérémy
PS: marking as coming from the app for now even though I have no idea :-)
Comments
Comment #1
anavarreFrom the main screen, the App crashes when selecting Content, then trying to retrieve the Published or Not published content.
I have an iPhone 4 with iOS 4.3 and tons of free space.
Comment #2
jchatard commentedCrap... I do have an iPhone 4, iOS 4.3, plenty of free space too, and it works.
Can you:
This should output OR download a file containing JSON formatted data.
Do you notice anything strange?
Comment #3
anavarreI've just commented line 81 in drupad.module
// return FALSE;http://yoursite.com/?q=drupad/content&status=1&page=1 gives a looong output
http://yoursite.com/?q=drupad/content&status=0&page=1 gives a short output
There is nothing that seems wrong at this stage
Comment #4
jchatard commentedAny reported error by validating those outputs with http://www.jsonlint.com ?
Comment #5
anavarreJSONLint says I have Valid JSON for the short output but I have errors on the long output.
When I copy/paste the output to JSONLint it says :
When I enter the URL, it says :
URL returned bad status code 401.I'm not sure it has actually errors. Maybe the output is too big for the online tool ? What do you think ?
Comment #6
jchatard commentedThe URL returns a code 401 because to access this URL you need to be authenticated, so your web server asks JSONLint a login and a password. So this 401 code is totally the expected behavior.
You seem to have an error in the returned JSON.
Can you send me an excerpt of your output? To see what this 66 line looks like.
Comment #7
anavarreActually, JSONLint tries to parse the file, formats it well, then stops at line 66, giving this line the rest of the long output as raw text as if the output was too big to parse.
When I try to reformat the code from line 66 to the next curly bracket, it valids just fine.
Sample :
Comment #8
jchatard commentedThe expected full format is as follow for 2 nodes:
Side note: you need the ending "meta" > "total_count".
My guess is you may have something wrong in the teaser property of one of the node (HTML), which causes JSONLint to think it's the end of the object (but too early).
Try to validate this structure with the node which is at line 66. Also try to inspect the teaser value of this node (and/or all properties). We need to know why JSONLint can't validate it.
Comment #9
anavarreOK, thank you for the info about the JSON format, now I understand the structure.
The first element on line 66 that gives an error is indeed related to the teaser part of a forum topic. Just to be sure, I've hidden all teaser fields for the topic content type. Unfortunately nothing better comes from this modification.
I've played again with JSONLint (nice tool !) and I've pruned many nodes by keeping the expected JSON output structure. The result is I've also had errors on the teaser part for other content types than "topic". For them, I just can't try and hide the teaser as it's used in production...
What if it was something in Drupal JSON teaser handling ?
Comment #10
jchatard commentedIf you send me by mail a teaser of a failing node (like one of your forum topic) I could try to have a look and maybe determine which chars aren't well encoded (as they are expected to for JSON).
All the JSON conversion is handled by drupal_json_output() (line 202 of the .module).
Which in fact lets PHP itself convert data to JSON.
So this doesn't look like a Drupal issue.
Comment #11
anavarreThank you for that. The one in #7 is a real (forum) node. I've just replaced the user/title/message/website infos by dummy text.
Comment #12
jchatard commented#7 validates actually!
And code from #7 integrated in my Drupal 7 instance - as if this was from my website - shows up correctly in my app with no crash.
2 solutions:
Other JSON validator/tools:
http://jsonformatter.curiousconcept.com/
http://labs.gerbenrobijn.nl/code-examples/json/jsonvalidator.html
http://jsonviewer.stack.hu/
Comment #13
anavarreSolution 2 is the correct one ! JSONLint Validator doesn't do (all) the job. I got my code validated from the other tools. The funny thing is JSONLint doesn't like raw formatting. Actually it validates the big output only when the code is formatted...
Comment #14
jchatard commentedOk,
I need to reproduce the bug form my computer to inspect the stack trace of the app.
Would you be able to create an account for me (only for testing purposes) which would allow me to access your site from my iPhone?
Comment #15
anavarreThank you, I've just sent a PM where you'll have all necessary informations.
Comment #16
BenK commentedSubscribing
Comment #17
anavarreSo I've created an access for Jérémy, everything worked for him but not for me. He then advised to reinstall the app as a final test...and it worked. I don't know what happened but this doesn't seem to be Drupad specific at all.