I build to iOS a bunch of scripts with a quite lot of Linq calls. The problem is that after adding some Linq calls some features stopped working properly. The problem persists only on actual iOS device, on PC and mac standalone it works fine. I saw that OrderBy, OrderByDescending may cause troubles on iOS. Is it true? And what else should I avoid when building to iOS?
1 Answer
1The only thing I know is that all LINQ functions which extended an IEnumerator/IEnumerable can create problems.
I’m not a LINQ pro but it seems to me that can create bugs due to AOT not supported that kind of things.
For example those functions probably generated errors : ThenByDescending / ThenBy…
I think you can have more informations here :
http://forum.unity3d.com/threads/116408-LINQ-stopped-working-on-iOS-(after-3.4-)
and here :
http://forum.unity3d.com/threads/84147-LINQ-on-iOS
and MSDN documentation on LINQ & Enumerable derivated method :
Maybe someone else can explain better than me because I’m not sure at 100% of my answer but I thing it’s a good track to start your investigation.
Before think I’m right maybe wait someone who know or can explain better than me on this subject. I think you can pass this problem I just never really try something like this on mobile devices so I can’t give you more details ![]()
I found that you CAN use Linq on a List, but NOT on an array. So I guess that the Linq functions for arrays use the IEnumerator, while the ones for List don't. Seems interesting.
– The-OddlerWe started having similar issues but it was only present when we were connected to Xcode. It would only throw the error at that point, but it would work fine when the device was independent for the developer machines. However everyone we deployed it to via AdHoc all crashed. Good find along the way, hopefully it can help other people and find a clear cut reason/resolution.
– prestonf
Update: OrderBy and OrderByDescending do not work on iOS. But the second part of the question stays -- what other Linq methods should I avoid when building to iOS?
– Valsidalv