This code is Javascript and not C# script. I would be willing to bet that somewhere in that hierarchy you aren’t defining your types. Unity’s iPhone compiler will let that go but you will end up with a null for that instance. For example if you do:
private var parser;
instead of
private var parser : XMLParser;
you will fail every time. It will work on the PC fine because it doesn’t have the constraint of not using dynamic types. The iPhone does NOT support this and you’ll have to tweak your scripts accordingly.
EtceteraBinding.showBezelActivityViewWithLabel("Loading Survey");
var tWWW = new WWW("http://www.dailyappdream.com/ExampleXML_Survey3.xml");
yield tWWW;
EtceteraBinding.hideActivityView();
if (tWWW.error != null)
{
EtceteraBinding.showAlertWithTitleMessageAndButton( "Error getting Survey!", tWWW.error, "OK" );
}
else
{
var parser : XMLParser = new XMLParser();
var node : XMLNode = parser.Parse(tWWW.text);
var val = node["Survey"][0]["details"][0]["@noOfQuestions"];
var questionsToProcessFloat : float = float.Parse(val,System.Globalization.CultureInfo.InvariantCulture.NumberFormat);
questionsToProcess = questionsToProcessFloat;
Debug.Log(questionsToProcess);
for(var QuestionNo = 0;QuestionNo < questionsToProcess-1;QuestionNo++){
questionIDArray[QuestionNo]=node["Survey"][0]["question"][QuestionNo]["@id"];
questionTypeArray[QuestionNo]=node["Survey"][0]["question"][QuestionNo]["@type"];
questionTextArray[QuestionNo]=node["Survey"][0]["question"][QuestionNo]["@questionText"];
questionOptionsArray[QuestionNo]=node["Survey"][0]["question"][QuestionNo]["@options"];
questionRepliesArray[QuestionNo] = "";
multiChoiceArray[QuestionNo] = 0;
}
This still works on the PC, and it no longer causes an EXEC_BAD_ACCESS crash on the device, however nor does it load the survey like it should. Anyone got any ideas/ can anyone point out anything I’m doing blatantly wrong?
Ok, I’ll pay $30 via paypal to anyone who can quickly make this work if I ping over the scripts?
If interested then just post as I need it sorting fairly urgently…