I use in the javaScript part of Wikitude JSON (like the SimpleBrowserDemo).
jsonObject = JSON.parse(jsonData);
This part does not seems to work properly for me.
I realized that the JSON part was inside the lib of wikitude1.1 and is not there anymore in wikitude 1.2. Now you can use the -ObjC Flag in other linker flag. I did integrate the SBJSON classes that where in the Simple Browser Demo. But still it seem not to work.
I had a lot of problems because i had an other JSON Framework in my app (problems started with the -ObjC Flag that fixed the error with the linker signaturs in Xcode). Even if i removed it and had only SBJSON from the demo left, the same.
If i switch back to 1.1 it works fine (in this case i use the JSON from the lib and removed all JSON Frameworks and left only the JSON.h to get no errors).
What i do not understand: from where the javaScript gets the JSON Framework in wikitude1.2 if i do:
jsonObject = JSON.parse(jsonData);
?????
Any idea why the JSON does not work for me with wikitude 1.2 ????
Please help.
I tried for hours and days.
I'm a paying user.
Regards
Adrian
A
Andreas Schacherbauer
said
over 10 years ago
Hi Adrian,
Javascripts JSON.parse has nothing to do with the SBJSON framework on iOS. JSON.parse is a built in function from webkits javascript engine. If you have problems parsing the json string, please make sure that the string is a valid json and check if you pass the json as a string or object from objc to javascript. For example: If you have something like this in ObjC '@"newData('%@')"' where %@ will be replaces with your json fromatted ObjC string, then you need JSON.parse to get a json object in javascript. If you replace the ObjC call with '@"newData(%@)"', then you don't need JSON.parse in javascript because you're passing an json object into javascript.
Best regards
Andreas
A
Adrian Busin
said
over 10 years ago
Thanks for the answer Andreas.
It's a big help for me that i understand now that the JSON.parse is a built in function from webkits javascript engine.
But if i leave all the javascript the same and switch back to sdk1.1 it works. But on 1.2 and 2.0 the javascript part seems not to work anymore.
I trie to do more debugging now (it's not so easy in the javascript part).
Before the JSON parsing i have the radar stuff. Perhaps i overlooked some changed there (i mena changes from the sdk11 to sdk12).
As soon i know more i will post it here. I You have any other idea why the javascript part stops working from 1.1 to 1.2 please let me know.
Here the javasript start part:
//++++++++Start and generates POIS and Buttons+++++++++++++++++++++++++++
function createOnClickAnimation(imageDrawable) { var anim = new AR.PropertyAnimation( imageDrawable, 'scaling', 1.0, 1.2, 750, new AR.EasingCurve(AR.CONST.EASING_CURVE_TYPE.EASE_OUT_ELASTIC, {amplitude : 2.0}) ); return anim; }
Adrian Busin