- Home /
using System.linq in Unity iPhone
I am trying to use System.linq implementations on Unity iPhone but having the following errors while trying to sort the variables.
ExecutionEngineException: Attempting to JIT compile method 'System.Linq.OrderedEnumerable`1<System.Collections.Generic.KeyValuePair`2<string, string>>:CreateOrderedEnumerable<string> (System.Func`2<System.Collections.Generic.KeyValuePair`2<string, string>, string>,System.Collections.Generic.IComparer`1<string>,bool)' while running with --aot-only.
I know that Unity iOS disallowed the runtime JIT compilation. Does anyone know how can I precompiled the System.linq library to avoid JIT compile method?
I really appreciate to your answers.
Answer by Visartech · Oct 15, 2014 at 11:07 AM
Really, some LINQ methods are not supported with Mono compiler on iOS and cause JIT-compile errors. In case if you would like to use LINQ methods on iOS in Unity, I would suggest you to look at LINQ to iOS.
It's a custom implementation of LINQ to Objects extension methods that works without JIT-compile errors on iOS.
Answer by andrey_bryzgalov · Oct 10, 2012 at 03:57 PM
Do not use value-types as keys in dictionary. KeyValuePair is structure, value-type.
Your answer
![](https://koobas.hobune.stream/wayback/20220613075918im_/https://answers.unity.com/themes/thub/images/avi.jpg)