Device Exception: SendMessage

tile=[emptyTile,tile1,tile2,tile3,tile4,tile5,tile6,tile7,tile8,tile9,tile10,tile11,tile12,tile13,tile14,tile15];
	puzzle =new FifteenPuzzle();	
	var tileNumber=0;
	puzzle.Randomize(1,true);
	for(var i=0; i<4;i++){
		for(var j=0; j<4; j++){
			var tilePosition=puzzle.getTile(i,j);
			Debug.Log("***************************************************"+i+","+j);
			tile[tilePosition].SendMessage("InitPosition",cubePositions[i][j],SendMessageOptions.DontRequireReceiver);
			
			tile[tilePosition].SendMessage("SetTilePosition",new Vector2(i,j),SendMessageOptions.DontRequireReceiver);
			
		}	
	}

above code is working fine in my system but if I tried to install if in ipad getting below exception, what may be the problem?

(Filename: /Applications/buildAgent/work/68355d6e5d19d587/Projects/…/Runtime/Export/Generated/BaseClass.cpp Line: 2535)

ExecutionEngineException: Attempting to JIT compile method ‘(wrapper dynamic-method) UnityEngine.GameObject:GameObject$SendMessage$System.String$UnityEngine.Vector2$UnityEngine.SendMessageOptions (object,object[ ])’ while running with --aot-only.

at System.Delegate.CreateDelegate (System.Type type, System.Object firstArgument, System.Reflection.MethodInfo method, Boolean throwOnBindFailure) [0x00000] in :0
at System.Delegate.CreateDelegate (System.Type type, System.Reflection.MethodInfo method, Boolean throwOnBindFailure) [0x00000] in :0
at System.Delegate.CreateDelegate (System.Type type, System.Reflection.MethodInfo method) [0x00000] in :0
at System.Reflection.Emit.DynamicMethod.CreateDelegate (System.Type delegateType) [0x00000] in :0
at Boo.Lang.Runtime.DynamicDispatching.Emitters.DispatcherEmitter.CreateMethodDispatcher () [0x00000] in :0
at Boo.Lang.Runtime.DynamicDispatching.Emitters.DispatcherEmitter.Emit () [0x00000] in :0
at Boo.Lang.Runtime.DynamicDispatching.MethodDispatcherFactory.EmitMethodDispatcher (Boo.Lang.Runtime.CandidateMethod found, System.Type[ ] argumentTypes) [0x00000] in :0
at Boo.Lang.Runtime.DynamicDispatching.MethodDispatcherFactory.Create () [0x00000] in :0
at Boo.Lang.Runtime.RuntimeServices.DoCreateMethodDispatcher (System.Object target, System.Type targetType, System.String name, System.Object[ ] args) [0x00000] in :0
at Boo.Lang.Runtime.RuntimeServices.CreateMethodDispatcher (System.Object target, System.String name, System.Object[ ] args) [0x00000] in :0
at Boo.Lang.Runtime.RuntimeServices+c__AnonStorey13.<>m__7 () [0x00000] in :0
at Boo.Lang.Runtime.DynamicDispatching.DispatcherCache.Get (Boo.Lang.Runtime.DynamicDispatching.DispatcherKey key, Boo.Lang.Runtime.DynamicDispatching.DispatcherFactory factory) [0x00000] in :0
at Boo.Lang.Runtime.RuntimeServices.Dispatch (System.Object target, System.String cacheKeyName, System.Type[ ] cacheKeyTypes, System.Object[ ] args, Boo.Lang.Runtime.DynamicDispatching.DispatcherFactory factory) [0x00000] in :0
at Boo.Lang.Runtime.RuntimeServices.Dispatch (System.Object target, System.String cacheKeyName, System.Object[ ] args, Boo.Lang.Runtime.DynamicDispatching.DispatcherFactory factory) [0x00000] in :0
at Boo.Lang.Runtime.RuntimeServices.Invoke (System.Object target, System.String name, System.Object[ ] args) [0x00000] in :0
at UnityScript.Lang.UnityRuntimeServices.Invoke (System.Object target, System.String name, System.Object[ ] args, System.Type scriptBaseType) [0x00000] in :0
at Swipe.Start () [0x00000] in :0

I am just guessing, since I am not an expert but…
SendMessage is using reflection. See Unity Manual > Getting Started with iOS Development > Optimizing Performance in iOS. > Optimizing iOS Players build Size

for a description of the stripping options in the player settings. Try disabling stripping to see if the error goes away.

If anyone wants to correct me, feel free. I won’t be offended. LOL

Most likely you are hitting some limitations Unity Script dynamic functionality. I would recommend to turn strict typing for your script on.
You can do this by adding following line at the very top of your script file:
#pragma strict

This might give you several compile time errors, but after fixing them you will get improved code compatibility with AOT.

Thanks for your reply mantasp.

I found the exception where I am getting exactly. Here send message is not the problem, I should not use dynamic type casting for the arrays.
I should specify the “tile[tilePosition]” type before going to use it.