Home Tutorials Download Beta Store Forum Documentation KnowledgeBase Wiki Blog

ShiVa3D

Return to Game programming

Unable to receive XML file on iOS  [SOLVED]

All about the StoneScript

Unable to receive XML file on iOS

Postby Continuity » 17 Jan 2012, 08:40

Hi all, I'm having some trouble receiving XML files when I'm running my game on iOS, but it works perfectly fine on Windows, here's the code
Code: Select all
    local bXmlReceived
    if (system.getOSType ( ) == system.kOSTypeIPhone)
    then       
         bXmlReceived = xml.receive ( this.xlevelListXml ( ), "file://".. system.getHomeDirectory ( ).."/XML/levelList.xml" )
    else
       
         bXmlReceived = xml.receive ( this.xlevelListXml ( ), "file://".. application.getPackDirectory ( ).."/Resources/XML/levelList.xml" )
    end


The directory of levelList.xml is gamefile/Resources/XML/

This works fine on Windows for me, but when I run it on iOS, the receive status for xlevelListXml will be -1, I've tried adding the xml files via the ShiVa authoring tool and the problem persists.

I'll provide additional information if needed, thanks a lot
Continuity
Fresh Boarder
Fresh Boarder
 
Posts: 4

Re: Unable to receive XML file on iOS  [SOLVED]

Postby Yopia » 17 Jan 2012, 09:39

Hi,

you should add the xml files in the additional resources of your Game and use xml.createFromResource function to load them.

In DataExplorer, use Import > XML menu to import xml in the project.
User avatar
Yopia
Platinum Boarder
Platinum Boarder
 
Posts: 630

Re: Unable to receive XML file on iOS

Postby Continuity » 17 Jan 2012, 10:29

Problem solved, thanks a lot
Continuity
Fresh Boarder
Fresh Boarder
 
Posts: 4


Return to Game programming