APPNAME was compiled with optimization - stepping may behave oddly; variables may not be available.

This is my .cs file.

IEnumerator DownloadModel(string modelUrl)
		{
			isDownloading = true;
			// Wait for the Caching system to be ready
			while (!Caching.ready)
				yield return null;
			
			// Load the AssetBundle file from Cache if it exists with the same version or download and store it in the cache
			WWW www = WWW.LoadFromCacheOrDownload (modelUrl, 1);
			Debug.Log ("modelURL : " + modelUrl);
			while (!www.isDone) {
				progressText.text = "Progress : " + (www.progress * 100).ToString ("N0") + "%";
				Debug.Log("Download Progress : " + (www.progress * 100).ToString ("N0") + "%");
				yield return null;
			}
			
			yield return www;	

			isDownloading = false;
			
			if (www.error != null) {
				throw new UnityException ("WWW download had an error:" + www.error);
			}
			
			AssetBundle bundle = www.assetBundle;
			
			downloadedObjectContainer = bundle.LoadAllAssets ();
			
			//				tempObj = Instantiate(downloadedObjectContainer[0]) as GameObject;
			//
			//				tempObj.transform.SetParent(this.transform);
			isDownloading = false;
			
			// Unload the AssetBundles compressed contents to conserve memory
			bundle.Unload (false);
			// memory is freed from the web stream (www.Dispose() gets called implicitly)
			
			Debug.LogWarning ("START CALLING OUT OBJECT");
			if (downloadedObjectContainer[0] != null) {
				
				Debug.Log("Downloadable content count : " + downloadedObjectContainer.Length );
				
				currentDownloadedModel = Instantiate(downloadedObjectContainer[0]) as GameObject;
				Debug.Log("OBJECT INSTANTIATE.");

				currentDownloadedModel.transform.SetParent(this.transform); 

				//set the ARContent and ImageTarget
				sic.setARContentAndMarker(currentDownloadedModel, ImageTarget);
				Debug.Log("CONTENT MARKER SET.");

				currentDownloadedModel.SetActive(true);
				
			}
			
			Debug.LogWarning ("COROUTINE FINISHED");
		}

and my “currentDownloadedModel” is declared at the top as GameObject.

public class cloudTrackableEventHandler : MonoBehaviour{

GameObject currentDownloadedModel;

When i build my App to Android, there is no problem at all. But once i build it in iOS, this error occurs

START CALLING OUT OBJECT
 
(Filename: /Users/builduser/buildslave/unity/build/artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 64)

Downloadable content count : 1
 
(Filename: /Users/builduser/buildslave/unity/build/artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 64)

MarcV2 was compiled with optimization - stepping may behave oddly; variables may not be available.

By the Debug.Log(), I found out that the problem occurs when I want to assign the currentDownloadedModel with the model i instantiate. Can anyone help me on this ? Thanks in advance.

Note : the “Script call optimization” at the unity player settings is set to “slow and safe”

For anyone who also face this problem, try uncheck the “Strip Engine Code” at File > Build Settings > Player Settings (iOS).

I am facing same issue.

For anyone who also face this problem, try uncheck the “Strip Engine Code” at File > Build Settings > Player Settings (iOS).

This option is not available in unity 5.3.5.

Please let me know if anyone fixed it.

Unity 5.5.0f3 & Xcode 8.2.1 , I uncheck the “Strip Engine Code” at File > Build Settings > Player Settings (iOS).
i also try with “Optimization Level” set => None.
but still my app crash sometimes .
Please post solution ,iff anyone fixed it.

1 Like

This is INCREDIBLY frustrating and is still happening to me almost 3 years later. Has anyone found a fix?

Its happening to me as well…anyone?

In my case, the application using too much memories causes the testing device crashes. You can test it with a better device. My application crashes in iPhone7 but not in iPhone7 Plus. And you can also check it in the Memory column in the left.

If application crashes when loading scene, here is the solution, or suggestion.

Assume there are 2 scenes, A and B. Both of them cost 1GB memory.
When A → B, A will be destroyed after B is loaded, which means 2GB is requested when A + B. It is too heavy for mobile.
So I add scene C, a middleware cost 0.1GB memory.
And now I go to scene B through A → C → B.
A + C request 1.1GB, then Scene A releases.
After that, C → B request 1.1GB.
The maximum memory of loading scene from A to B decrease from 2GB to 1.1GB. It solved my application crashing problem.

Hope it helps.