Приложение iOS в Xamarin вылетает при переходе на TestFlight - PullRequest
0 голосов
/ 28 июня 2018

Я создаю приложение, используя Xamarin. В процессе разработки все шло нормально, но когда я загрузил свое приложение в TestFlight, оно начало падать при запуске.

Apple прислала мне отчеты о сбоях, и я смог обозначить их символами, чтобы получить более подробную информацию о сбое. Проблема, даже символизированная, отчет о сбое ничего не значит для меня. Я уже несколько дней ищу в Google решение, но чувствую, что даже не близок к его решению.

Может кто-нибудь посмотреть и решить, решил ли что-нибудь подобное или, по крайней мере, указать мне направление, чтобы я мог отладить это? Спасибо!

Это отчет о сбое:

{"bug_type":"109","os_version":"iPhone OS 10.3.3 (14G60)","build_version":"48","timestamp":"2018-06-28 16:12:19.74 -0300","is_beta":true,"app_name":"P4L.iOS","app_cohort":"2|date=1530212400000&sf=143503&tid=518f06aecf3d87eeb51b61374ac47cb8d62f439ed82ef8d8f321858a7cb6ce88&ttype=i","bundleID":"com.personal4life.p4l","incident_id":"8978A90F-616B-4CB6-9315-6611AF101D2D","name":"P4L.iOS","is_first_party":false,"app_version":"2.1.3","share_with_app_devs":true,"slice_uuid":"cfe7d5a2-acef-3914-9a42-1d8f7ec59662","adam_id":1196250182}
Incident Identifier: 8978A90F-616B-4CB6-9315-6611AF101D2D
Beta Identifier:     B6670B13-0316-4C14-8DE0-09E50F8692D1
Hardware Model:      iPhone5,1
Process:             P4L.iOS [276]
Path:                /private/var/containers/Bundle/Application/8B965BF1-F669-4CDD-A54E-28A16891ACD3/P4L.iOS.app/P4L.iOS
Identifier:          com.personal4life.p4l
Version:             48 (2.1.3)
Beta:                YES
Code Type:           ARM (Native)
Role:                Foreground
Parent Process:      launchd [1]
Coalition:           com.personal4life.p4l [425]


Date/Time:           2018-06-28 16:12:19.5052 -0300
Launch Time:         2018-06-28 16:12:18.0000 -0300
OS Version:          iPhone OS 10.3.3 (14G60)
Report Version:      104

Exception Type:  EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note:  EXC_CORPSE_NOTIFY
Triggered by Thread:  0

Application Specific Information:
abort() called

Filtered syslog:
None found

Thread 0 name:  tid_403  Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0   libsystem_kernel.dylib          0x1cc41acc __pthread_kill + 8
1   libsystem_pthread.dylib         0x1ccfa086 pthread_kill + 62
2   libsystem_c.dylib               0x1cbd69d2 __abort + 108
3   libsystem_c.dylib               0x1cbd6966 __abort + 0
4   P4L.iOS                         0x0173828c xamarin_printf + 23773836 (runtime.m:2381)
5   P4L.iOS                         0x01691530 mono_invoke_unhandled_exception_hook + 23090480 (exception.c:1119)
6   P4L.iOS                         0x0165f402 mono_handle_exception_internal + 22885378 (mini-exceptions.c:2080)
7   P4L.iOS                         0x0165e504 mono_handle_exception + 22881540 (mini-exceptions.c:2371)
8   P4L.iOS                         0x016574d0 mono_arm_throw_exception + 22852816 (exceptions-arm.c:172)
9   P4L.iOS                         0x0038a344 throw_exception + 64
10  P4L.iOS                         0x00092cc4 native_to_managed_trampoline_19(objc_object*, objc_selector*, _MonoMethod**, UIApplication*, NSDictionary*, unsigned int) + 27844 (registrar.m:792)
11  P4L.iOS                         0x0009311c -[AppDelegate application:didFinishLaunchingWithOptions:] + 28956 (registrar.m:9757)
12  UIKit                           0x227155c4 -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] + 376
13  UIKit                           0x22916a4a -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 3706
14  UIKit                           0x2291bc1c -[UIApplication _runWithMainScene:transitionContext:completion:] + 1640
15  UIKit                           0x2292e7c4 __84-[UIApplication _handleApplicationActivationWithScene:transitionContext:completion:]_block_invoke.3149 + 40
16  UIKit                           0x2291935a -[UIApplication workspaceDidEndTransaction:] + 142
17  FrontBoardServices              0x1ed54c12 __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 18
18  FrontBoardServices              0x1ed54acc -[FBSSerialQueue _performNext] + 220
19  FrontBoardServices              0x1ed54db6 -[FBSSerialQueue _performNextFromRunLoopSource] + 44
20  CoreFoundation                  0x1d42ffdc __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 12
21  CoreFoundation                  0x1d42fb04 __CFRunLoopDoSources0 + 424
22  CoreFoundation                  0x1d42df50 __CFRunLoopRun + 1160
23  CoreFoundation                  0x1d3811ae CFRunLoopRunSpecific + 470
24  CoreFoundation                  0x1d380fd0 CFRunLoopRunInMode + 104
25  UIKit                           0x2270ee2c -[UIApplication _run] + 660
26  UIKit                           0x22709a52 UIApplicationMain + 150
27  P4L.iOS                         0x00b74a88 wrapper_managed_to_native_UIKit_UIApplication_UIApplicationMain_int_string___intptr_intptr + 288
28  P4L.iOS                         0x00ae50e4 UIKit_UIApplication_Main_string___intptr_intptr + 10850532 (UIApplication.cs:80)
29  P4L.iOS                         0x00ae50a4 UIKit_UIApplication_Main_string___string_string + 10850468 (UIApplication.cs:64)
30  P4L.iOS                         0x000b78a8 P4L_iOS_Application_Main_string__ + 178344 (/<unknown>:1)
31  P4L.iOS                         0x00358888 wrapper_runtime_invoke_object_runtime_invoke_dynamic_intptr_intptr_intptr_intptr + 232
32  P4L.iOS                         0x01669c36 mono_jit_runtime_invoke + 22928438 (mini-runtime.c:2783)
33  P4L.iOS                         0x016baa78 mono_runtime_invoke_checked + 23259768 (object.c:2887)
34  P4L.iOS                         0x016be8aa mono_runtime_exec_main_checked + 23275690 (object.c:0)
35  P4L.iOS                         0x01656e58 mono_jit_exec + 22851160 (driver.g.c:1210)
36  P4L.iOS                         0x0173f848 xamarin_main + 23803976 (monotouch-main.m:0)
37  P4L.iOS                         0x000b7420 main + 177184 (main.m:172)
38  libdyld.dylib                   0x1cb6e4ea start + 2

Это мой AppDelegate.cs (я не писал этот код, пожалуйста, не судите меня):

using AVFoundation;
using Facebook.CoreKit;
using Facebook.LoginKit;
using Facebook.ShareKit;
using FFImageLoading.Forms.Touch;
using Foundation;
using HockeyApp.iOS;
using ImageCircle.Forms.Plugin.iOS;
using Octane.Xam.VideoPlayer.iOS;
using P4L.itemagendamento;
using P4L.utils;
using Syncfusion.SfCalendar.XForms.iOS;
using Syncfusion.SfChart.XForms.iOS.Renderers;
using Syncfusion.SfNumericTextBox.XForms.iOS;
using UIKit;

namespace P4L.iOS
{
    // The UIApplicationDelegate for the application. This class is responsible for launching the 
    // User Interface of the application, as well as listening (and optionally responding) to 
    // application events from iOS.
    [Register("AppDelegate")]
    public partial class AppDelegate : global::Xamarin.Forms.Platform.iOS.FormsApplicationDelegate
    {
        //
        // This method is invoked when the application has loaded and is ready to run. In this 
        // method you should instantiate the window, load the UI into it and then make the window
        // visible.
        //
        // You have 17 seconds to return from this method, or iOS will terminate your application.
        //
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            global::Xamarin.Forms.Forms.Init();

            ImageCircleRenderer.Init();

            Profile.EnableUpdatesOnAccessTokenChange(true);
            Settings.AppID = "my_app_id";
            Settings.DisplayName = "P4L";


            App.CreateNotificationiOS = Create;
            App.DeleteAllNotifications = DeleteAllNotifications;

            App.facebookLogout = () =>
            {
                new LoginManager().LogOut();    
                return true;
            };

            App.facebookShare = (string path) =>
            {
                Facebook.ShareKit.SharePhoto photo = SharePhoto.From(new UIImage(path), true);
                Facebook.ShareKit.SharePhotoContent content = new Facebook.ShareKit.SharePhotoContent();
                content.Photos = new SharePhoto[] { photo };

                Facebook.ShareKit.ShareDialog dialog = new Facebook.ShareKit.ShareDialog();
                dialog.SetShareContent(content);

                if(dialog.CanShow())
                {
                    dialog.Show();
                    return true;
                }

                return false;
            };

            if (options != null)
            {
                // check for a local notification
                if (options.ContainsKey(UIApplication.LaunchOptionsLocalNotificationKey))
                {
                    var localNotification = options[UIApplication.LaunchOptionsLocalNotificationKey] as UILocalNotification;
                    if (localNotification != null)
                    {
                        UIApplication.SharedApplication.ApplicationIconBadgeNumber = 0;
                    }
                }
            }
            UIApplication.SharedApplication.ApplicationIconBadgeNumber = 0;

            LoadApplication(new App());

            var manager = BITHockeyManager.SharedHockeyManager;
            manager.Configure("my_id");
            manager.StartManager();
            manager.Authenticator.AuthenticateInstallation();
            manager.CrashManager.CrashManagerStatus = BITCrashManagerStatus.AutoSend;

            NSError error;
            AVAudioSession instance = AVAudioSession.SharedInstance();
            instance.SetCategory(new NSString("AVAudioSessionCategoryPlayback"), AVAudioSessionCategoryOptions.MixWithOthers, out error);
            instance.SetMode(new NSString("AVAudioSessionModeDefault"), out error);
            instance.SetActive(true, AVAudioSessionSetActiveOptions.NotifyOthersOnDeactivation, out error);
            new SfCalendarRenderer();
            new SfNumericTextBoxRenderer();
            new SfChartRenderer();

            if (UIDevice.CurrentDevice.CheckSystemVersion(8, 0))
            {
                var notificationSettings = UIUserNotificationSettings.GetSettingsForTypes(
                    UIUserNotificationType.Alert | UIUserNotificationType.Badge | UIUserNotificationType.Sound, null
                );

                app.RegisterUserNotificationSettings(notificationSettings);
            }

            CachedImageRenderer.Init();
            FormsVideoPlayer.Init("my_id");

            return base.FinishedLaunching(app, options);
            //return ApplicationDelegate.SharedInstance.FinishedLaunching(app, options);
        }

        public override bool OpenUrl(UIApplication application, NSUrl url, string sourceApplication, NSObject annotation)
        {
            // We need to handle URLs by passing them to their own OpenUrl in order to make the SSO authentication works.
            return ApplicationDelegate.SharedInstance.OpenUrl(application, url, sourceApplication, annotation);
        }

        public override void ReceivedLocalNotification(UIApplication application, UILocalNotification notification)
        {
           // reset our badge

        }

        public bool Create(double date, string title, string message)
        {
            // create the notification
            var notification = new UILocalNotification();

            // set the fire date (the date time in which it will fire)
            notification.FireDate = NSDate.FromTimeIntervalSince1970(date);

            // configure the alert
            notification.AlertAction = title;
            notification.AlertBody = message;

            // set the sound to be the default sound
            notification.SoundName = UILocalNotification.DefaultSoundName;

            // schedule it
            UIApplication.SharedApplication.ScheduleLocalNotification(notification);

            return true;
        }

        public bool DeleteAllNotifications()
        {
            UIApplication.SharedApplication.CancelAllLocalNotifications();
            return true;
        }
    }
}

UPDATE

Используя консоль iOS для вывода журналов моего устройства, я обнаружил следующую трассировку стека:

The type initializer for 'P4L.App' threw an exception. (System.TypeInitializationException)
  at (wrapper managed-to-native) UIKit.UIApplication.UIApplicationMain(int,string[],intptr,intptr)
  at UIKit.UIApplication.Main (System.String[] args, System.IntPtr principal, System.IntPtr delegate) <0xaf2110 + 0x00033> in <9c9f52cf075c47a2b98fd2456ad4ddfc#d50a5bacc6b9d3e09ee9e2bd80b73110>:0 
  at UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) <0xaf203c + 0x000c7> in <9c9f52cf075c47a2b98fd2456ad4ddfc#d50a5bacc6b9d3e09ee9e2bd80b73110>:0 
  at P4L.iOS.Application.Main (System.String[] args) <0xc0878 + 0x0002f> in <b64be1cd8d184c63bb092227a0c291e0#d50a5bacc6b9d3e09ee9e2bd80b73110>:0 
 --- inner exception ---
You MUST call Xamarin.Forms.Init(); prior to using it. (System.InvalidOperationException)
  at Xamarin.Forms.Device.get_PlatformServices () <0x41fbb8 + 0x00074> in <6e20d7af277949f4a7bb952d64b81cda#d50a5bacc6b9d<\M-b\M^@\M-&>

Что кажется странным, поскольку Xamarin.Forms.Init(); - это первое, что я называю в AppDelegate.cs, и все отлично работает, когда я создаю приложение на своих устройствах. Вернуться к Google, чтобы увидеть, что я могу найти .. В любом случае, если кто-то знает, почему это происходит, не стесняйтесь поделиться с нами.

...