简体   繁体   中英

Weird Xamarin.iOS bug only with Enable debug on (adhoc/release builds)

I've two weird issues with Xamarin.iOS:

1) NavigationController.PushViewController does work correctly with Debug enabled and NOT with debug disabled.

2) With debug disabled the app crashes after about 60 seconds, but not crash log on the device.

First I noticed the difference between Debug and AdHoc build. But now when I use AdHoc build and turn on 'Enabling debug' it magically works, without further adjustments to settings. Debug symbols are removed and Debug info is set to None.

I saw two other similar questions on this forum and forums.xamarin from a couple of years ago with no answers. I tried different linker and compiler and GC settings on the project but they were not helpful.

Hope someone can help me out.

You can use one hack to get more information about the crash from a device. Since all your code is executable through mono runtime, you can easily catch lots of crashes by wrapping your UIAplication.Main function into a try-catch block, and save the exception string somewhere on the device.

in Main.cs

public class Application {
    static void Main(string[] args) {
        try {
            UIApplication.Main(args: args, principalClassName: null, delegateClassName: typeof(AppDelegate).Name);
        } catch (Exception e) {
            // save e.ToString() somewhere
        }
    }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM