LitJSON Uninitialized JSONData?

I have been playing around with integrating some webservices into my system and started using LitJson based on some posts around here. However I’ve come across a bizarre error that seems to only manifest itself on iOS. Most times this code works just fine, but sometimes I am getting “Uninitialized JsonData” for the ToString.

		this.lastResponse = responseData;
		
		JsonData jsonFences = JsonMapper.ToObject( responseData );
		GeoFence fence;	
		
		for ( int i = 0; i < jsonFences["fences"].Count; i++ )
		{
			fence = new GeoFence();
			fence.id = jsonFences["fences"][i]["id"].ToString();
			fence.name = jsonFences["fences"][i]["name"].ToString();
			
			print ("Processed fence " + fence.name);
			
			fenceList.Add( fence );
		}

Not sure where that is coming from. Weirdness. Even looking through the code in XCode there doesn’t appear to be an issue with the JSON, just the interpretation of it by LitJSON.

Hi

Did you ever find out why you were getting this error? I have the same problem, sometimes it works sometimes i get the said error.

Same problem here. Any solution?

I have same issue! I’m trying to read response from FB.API, sometimes it works but suddenly it starts showing Uninitialized Json data. Also some times it gives me Key doesn’t exist error although the response is same.

There are some issues with AOT and collections that cause GetEnumerator() to break. It also appears that sometimes arrays get destroyed and filled with 0’s. Similar issues have been reported here:

http://forum.unity3d.com/threads/168019-quot-System-String-doesn-t-implement-interface-System-Collections-IEnumerator-quot-crash

I’ve actually implemented FeatureCreep’s fix in my JSON .NET asset and it seems to have solved the problems.