zoukankan      html  css  js  c++  java
  • Xamarin adventures – Differences between iOS simulator and device

    I had been happily coding an iOS app (targeting iPad) using Xamarin/VS.Net with everything working fine when debugging in the iOS simulator, however as soon as I started trying to push the app to a physical device (iPad 4th gen) I started getting problems.

    Problem 1 – failed to resolve System.Linq.Expressions.MethodCallExpression

    The IOC framework I was using was internally using Linq expressions to construct objects. This in turn invokes some form of JIT compilation which is not allowed on iOS. (To be fair the IOC framework didn’t specifically support Monotouch, but I recompiled as a PCL and referenced it from my iOS project and all seemed to be working fine in the iOS simulator).

    To fix the problem I switched out the IOC framework with TinyIoC (a simple IOC container that you can include in your project by including a single cs file – nice!).

    Problem 2 – Attempting to JIT compile method ‘…’ while running with –aot-only

    The ‘…’ in the error message (which has been stripped out for readability) was reference to a generic method. Even though Xamarin.iOS 6.4 includes “iOS generic compiler improvements” resulting in “fewer ‘Attempting to JIT compile method’ errors” it turns out that it didn’t like generics in one particular method that I had in the code base. (I haven’t been able to figure out exactly why this use of generics was any different to other usages).

    To fix the problem I rewrote the offending code without using generics.

    Thoughts

    I’m loving being able to build iOS apps using familiar tools (VS.Net) and languages (C#) but it helps to be aware of some of the potential gotchas. More (hopefully not too many more) to come…

  • 相关阅读:
    N的阶乘:高精度
    蓝桥杯历届试题 连号区间数:枚举(含样例解释)
    最大公共子串:DP
    IncDec序列:差分+贪心
    [ACM] hdu 1465 不容易系列之一(错排复习)
    写给现在,写给未来
    [ACM] hdu 2082 找单词 (母函数)
    [ACM] poj 1146 ID Codes(字符串的下一个排列)
    [ACM] hdu 2149 Public Sale (巴什博奕)
    [ACM] hdu 1846 Brave Game (巴什博奕)
  • 原文地址:https://www.cnblogs.com/zjoch/p/4707229.html
Copyright © 2011-2022 走看看