Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: zzap64 on December 07, 2020, 01:37:21 PM

Title: SOLVED - Runtime on Device not displaying XML
Post by: zzap64 on December 07, 2020, 01:37:21 PM
Hey all,
Im having a problem with XML string (or proxy) not displaying on iOS device.

In Unity editor it works fine, I use Get Web request, and save into a string, variables display the xquery results perfectly.

Once built...I then run on the device thru xcode. Testing on ios device i can see the xml variables are not displayed. Ive updated everything and tried the xml Linker Wizard but still scratching my head?? Could it be some formatting of the XML I need to change that will work nice with xcode?
Title: Re: Runtime on Device not displaying XML
Post by: zzap64 on December 09, 2020, 11:51:15 AM
I dont have much more info to add....im not receiving any errors in the Unity console or Xcode.

I just dont understand why on device none of my XML variables are being displayed, Json is fine. I'm using Datamaker.

Can I supply any further info to help my case here as its driving me crazy? thankyou.
Title: Re: Runtime on Device not displaying XML
Post by: djaydino on December 09, 2020, 01:52:07 PM
Hi.
Try setting up A Debug fsm.

Use "Get Fsm State" and use a Ui Text to show on screen.

It might be that it gets stuck in the web request for example
Title: Re: Runtime on Device not displaying XML
Post by: zzap64 on December 09, 2020, 02:52:38 PM
Hey Thanks for the reply,

good idea on get fsm states, they all worked except the web request, so there lies the culprit I guess. attached a screen shot to see if i'm doing something wrong?
Title: Re: Runtime on Device not displaying XML
Post by: zzap64 on December 09, 2020, 05:47:19 PM
just to add,

what is making my head hurt is that json data the url is getting does show up on the device....its just when its converted to xml it doesn't.
Title: Re: Runtime on Device not displaying XML
Post by: zzap64 on December 09, 2020, 09:11:51 PM
this is what i see in xcode output during runtime:

System.Reflection.Emit.DynamicMethod::.ctor
HutongGames.PlayMaker.Actions.ConvertJsonStringToXmlNode:ConvertFromJsonString()
HutongGames.PlayMaker.Actions.ConvertJsonStringToXmlNode:OnEnter()
HutongGames.PlayMaker.FsmState:ActivateActions(Int32)
HutongGames.PlayMaker.FsmState:OnEnter()
HutongGames.PlayMaker.Fsm:UpdateStateChanges()
HutongGames.PlayMaker.Fsm:Update()
 
(Filename: ./Runtime/Export/Debug/Debug.bindings.h Line: 35)

FsmXmlSource:GetXmlNodeFromString(String)
HutongGames.PlayMaker.Actions.XmlGetNodeProperties:GetNodeProps()
HutongGames.PlayMaker.Actions.XmlGetNodeProperties:OnEnter()
HutongGames.PlayMaker.FsmState:ActivateActions(Int32)
HutongGames.PlayMaker.FsmState:OnEnter()
HutongGames.PlayMaker.Fsm:UpdateStateChanges()
HutongGames.PlayMaker.Fsm:Update()
 
(Filename: ./Runtime/Export/Debug/Debug.bindings.h Line: 35)

Root element is missing.
FsmXmlSource:GetXmlNodeFromString(String)
HutongGames.PlayMaker.Actions.XmlGetNodeProperties:GetNodeProps()
HutongGames.PlayMaker.Actions.XmlGetNodeProperties:OnEnter()
HutongGames.PlayMaker.FsmState:ActivateActions(Int32)
HutongGames.PlayMaker.FsmState:OnEnter()
HutongGames.PlayMaker.Fsm:UpdateStateChanges()
HutongGames.PlayMaker.Fsm:Update()
 
(Filename: ./Runtime/Export/Debug/Debug.bindings.h Line: 35)
Title: Re: Runtime on Device not displaying XML
Post by: djaydino on December 10, 2020, 07:53:16 AM
Hi.
For testing you should set the get fsm state action in a separate fsm/gameobject.
then you can see if it stops somewhere.

Other way you could do testing is add a 'Get Key Down' this way you can do each state step by step.

after the web request 1st try if it shows the json data. (display stored thext)

then next, after convert show if xml is showing.
Title: Re: Runtime on Device not displaying XML
Post by: zzap64 on December 10, 2020, 07:59:15 PM
Thanks again for your swift reply, really appreciate your help. This is an app for my local community.


I went step by step and xcode shows 'root element is missing' at my get xml nodes state.


see attached, a combined screen shot of my state flow. as you can see the xml variables are populated in the editor but ultimately not on device. thankyou.

ps. i'm wondering if the 'root' for the json file is the issue? do i just add an arbitrary root name such as 'root' or is there a string ref in the json file i should use?
Title: Re: Runtime on Device not displaying XML
Post by: zzap64 on December 10, 2020, 09:02:31 PM
adding json string txt attachment.
Title: Re: Runtime on Device not displaying XML
Post by: djaydino on December 11, 2020, 06:10:02 AM
Hi.
I haven't used json yet, only xml.

maybe you can try to make a build on mac/windows platform and see if it works there.

i will ping Jean if he knows what the issue is.
Title: Re: Runtime on Device not displaying XML
Post by: jeanfabre on December 11, 2020, 06:15:15 AM
Hi,

 that's very odd, I am using datamaker everyday and publish on IOS often without any problem.


- Are you sure you are getting the same data on IOS than in editor?
- Can you send me the raw data you are using? I'll try on my end.

- there could be some location issue that on IOS the text is saved and encoded differently. Do you think you could face something like that?

Bye,

 Jean
Title: Re: Runtime on Device not displaying XML
Post by: zzap64 on December 12, 2020, 10:57:48 PM
Hey Djaydino & Jean (appreciate your continued help)

I tried a Mac build (and WebGL) and it does the same problem so now we know its not related to device.

I added a couple examples of the of the urls i pull.

as a side test....I thought to create a new basic project, just with the web request and UI actions to display the variables but I couldn't find Web Request on the Eco system, where is that action?
I stripped out everything from my current project so can make that available if you need it.
Title: Re: Runtime on Device not displaying XML
Post by: zzap64 on December 14, 2020, 01:04:11 PM
I managed to get my url source as xml without having to convert from json, I  adjusted the xpath query and it worked on the Mac build...yay...BUT on ios device it still shows a blank! sad face. now i'm really stumped.

Title: Re: Runtime on Device not displaying XML
Post by: djaydino on December 14, 2020, 05:51:00 PM
Hi.
I have no experience in building for ios so i need to guess as well :)

Have you tried to use a xml directly in build (so without getting from url) to test.

if that works then it might be when getting it from the url.

Title: Re: Runtime on Device not displaying XML
Post by: zzap64 on December 15, 2020, 01:04:00 AM
hiya,

ok, one big step nearer :)

my url's with xml as its source works ok, no matter on what device. I played around with xml variables and xpath and some how magically started to work.

my remaining issue is the action of Json to XML conversion, this is where i seem to have problems. Editor is fine but xcode brings back the same old issues of a problem root on the converted xml.
I have converted the json to xml via an online web converter tool and accessed that xml string at runtime on the device and it works fine.

Leads me to think I must be doing something wrong with the Datamaker json to xml conversion action???

As per attachments, XML says valid and on the json>xml conversion I just save the xml as a string variable. also added the json text from the url.

Title: Re: Runtime on Device not displaying XML
Post by: zzap64 on December 15, 2020, 11:34:25 PM
does this hold any clue ?
Title: Re: Runtime on Device not displaying XML
Post by: zzap64 on December 17, 2020, 02:09:31 PM
Is there some relationship between Linker and the output from Json to Xml, could this be the cause of my issue ?
Title: Re: Runtime on Device not displaying XML
Post by: zzap64 on December 22, 2020, 03:40:42 PM
that strange feeling of just talking to myself ;)

as an alternative, are there any options to select nodes in json to extract specific data similar to xml query?
Title: Re: Runtime on Device not displaying XML
Post by: jeanfabre on December 23, 2020, 06:04:45 AM
Hi,

 yeah, it looks like you are missing some class.


can you confirm that you have the same raw json input in editor and in production? I would verify this first. then move into publishing without stripping, and if it works then look into what class exactly is missing.

Bye,

 Jean
Title: Re: Runtime on Device not displaying XML
Post by: zzap64 on December 23, 2020, 01:17:14 PM
Hey Jean

Thanks for the reply, i do need help  :'(

I've tried multiple different Json sources and examples, its just after the conversion to xml the result is always seen as null/empty when publishing. Ive tried string variable, text file and proxy.
my stripping is set to low on ill2cpp.

here's a random json example off the net i tried just now, same thing happens, works in editor but nothing when built.

{
   "glossary":{
      "title":"example glossary",
      "glossdiv":{
         "title":"s",
         "glosslist":{
            "glossentry":{
               "id":"sgml",
               "sortas":"sgml",
               "glossdef":{
                  "para":"a meta-markup language, used to create markup languages such as ",
                  "glossseealso":[
                     "gml",
                     "xml"
                  ]
               },
               "glosssee":"markup"
            }
         }
      }
   }
}
Title: Re: Runtime on Device not displaying XML
Post by: jeanfabre on December 24, 2020, 02:19:36 AM
Hi,

Have you tried with no stripping? it's important to check that it works if there is no stripping.

Bye,

 Jean
Title: Re: Runtime on Device not displaying XML
Post by: zzap64 on December 24, 2020, 01:23:05 PM
Hey Jean,

AFAIK on IL2CPP the lowest level of stripping is LOW, thats what i'm set on.
Title: Re: Runtime on Device not displaying XML
Post by: djaydino on December 25, 2020, 07:30:19 AM
hi.
There is a check box 'Strip Engine Code' (just above the stripping level)

Uncheck that to build without stripping.
Title: Re: Runtime on Device not displaying XML
Post by: zzap64 on December 26, 2020, 01:57:04 PM
Hey Djay,

I had high hopes this may of been the solution but unfortunately nothing changed :(
Title: SOLVED Re: Runtime on Device not displaying XML SOLVED
Post by: zzap64 on February 08, 2021, 06:47:21 PM
Finally figured it out. Two factors, the Newtonsoft.json didnt have ios selected but most importantly I replaced it with https://assetstore.unity.com/packages/tools/input-management/json-net-for-unity-11347
and now it works...Im sooo happy. Big thanks to Jean and Djay who replied to my previous messages.
Title: Re: SOLVED - Runtime on Device not displaying XML
Post by: djaydino on February 09, 2021, 08:40:33 AM
Hi.
I'm Happy you figured it out AND also that you mention the solution here!