Quantcast
Channel: Active questions tagged crash - Stack Overflow
Viewing all articles
Browse latest Browse all 7191

Why does app crash on iOS 14 when setting UIDatePicker preferredDatePickerStyle

$
0
0

The problem:

  • User reports iOS crashes when calling datePicker.preferredDatePickerStyle = ... in Swift or [self.datePicker setPreferredDatePickerStyle:UIDatePickerStyleInline] in Objective-C
  • The app is available from iOS 12+ but this code is only called in iOS 14+
  • I was not able to reproduce the issue on any device or in simulator
  • No other users reported the same problem

Details:

A user of my iOS 12+ reported that the app crashes after the update when using different features. The user send me multiple crash reports and I was able to symbolicate them using Xcode. The reports show, that the crash occurs in two different view controllers but in the same situation: When setting the preferredDatePickerStyle of UIDatePicker.

One view controller uses Objective-C while the other is newer and uses swift:

// Swiftclass MyViewControllerA {    @IBOutlet var datePicker: UIDatePicker!    ...    override func viewDidLoad() {        super.viewDidLoad()        if #available(iOS 14.0, *) {            datePicker.preferredDatePickerStyle = .inline   // << CRASH        }        ...    }}// Objective-C@interface MyViewControllerB : UIViewController    ...    @property (strong, nonatomic) IBOutlet UIDatePicker *datePicker;@end...- (void)viewDidLoad {    [super viewDidLoad];      ...     if (@available(iOS 14, *)) {        [self.datePicker setPreferredDatePickerStyle:UIDatePickerStyleInline];  // << CRASH    }  }

preferredDatePickerStyle is available since iOS 13.4+, thus calling it with if (@available(iOS 14, *)) should be not problem, should it?

I cannot see anything problematic at these lines. There is no reason why datePicker should be nil in the Swift VC and if it would be nil in the Objective-C version it would be no problem, would it?

There are no reports by other users and I was not able to reproduce the issue in several test. Everything works just as expected.


Crash Reports:

These are the device details from the crash reports:

Hardware Model:      iPhone10,6Process:             MyApp [12455]Path:                /private/var/containers/Bundle/Application/UUID/MyApp.app/MyAppIdentifier:          com.example.MyAppVersion:             3.0.2.1 (3.0.2)AppStoreTools:       12D4dAppVariant:          1:iPhone10,6:13Code Type:           ARM-64 (Native)Role:                ForegroundParent Process:      launchd [1]Coalition:           com.example.MyApp [910]Date/Time:           2021-02-18 15:00:30.0155 +0200Launch Time:         2021-02-18 15:00:24.0409 +0200OS Version:          iPhone OS 14.4 (18D52)Release Type:        UserBaseband Version:    4.02.01Report Version:      104

Crash Report in Objective-C VC:

Exception Type:  EXC_CRASH (SIGABRT)Exception Codes: 0x0000000000000000, 0x0000000000000000Exception Note:  EXC_CORPSE_NOTIFYTriggered by Thread:  0Application Specific Information:abort() calledLast Exception Backtrace:0   CoreFoundation                  0x18b3999d8 0x18b27f000 + 11575921   libobjc.A.dylib                 0x19f71fb54 0x19f719000 + 274762   CoreFoundation                  0x18b2a850c 0x18b27f000 + 1692283   Foundation                      0x18c5a2878 0x18c52b000 + 4895924   UIKitCore                       0x18e1160f0 0x18d0d6000 + 170396005   UIKitCore                       0x18d7716f4 0x18d0d6000 + 69281166   UIKitCore                       0x18d8524f4 0x18d0d6000 + 78492047   UIKitCore                       0x18d84fad0 0x18d0d6000 + 78384168   UIKitCore                       0x18d850fe4 0x18d0d6000 + 78438129   UIKitCore                       0x18d851224 0x18d0d6000 + 784438810  UIKitCore                       0x18d17b938 0x18d0d6000 + 67820011  UIKitCore                       0x18d17bcd8 0x18d0d6000 + 67912812  UIKitCore                       0x18d17d354 0x18d0d6000 + 68488413  UIKitCore                       0x18db77584 0x18d0d6000 + 1114662814  UIKitCore                       0x18db7a1f8 0x18d0d6000 + 1115800815  MyApp                           0x102b51d94 -[DatePickerViewController viewDidLoad] + 712084 (DatePickerViewController.m:88)16  UIKitCore                       0x18d53ee50 0x18d0d6000 + 462395217  UIKitCore                       0x18d543408 0x18d0d6000 + 464180018  UIKitCore                       0x18d5437e8 0x18d0d6000 + 4642792

Crash Report in Swift VC

Exception Type:  EXC_CRASH (SIGABRT)Exception Codes: 0x0000000000000000, 0x0000000000000000Exception Note:  EXC_CORPSE_NOTIFYTriggered by Thread:  0Application Specific Information:abort() calledLast Exception Backtrace:0   CoreFoundation                  0x18b3999d8 0x18b27f000 + 11575921   libobjc.A.dylib                 0x19f71fb54 0x19f719000 + 274762   CoreFoundation                  0x18b2a850c 0x18b27f000 + 1692283   Foundation                      0x18c5a2878 0x18c52b000 + 4895924   UIKitCore                       0x18e1160f0 0x18d0d6000 + 170396005   UIKitCore                       0x18d7716f4 0x18d0d6000 + 69281166   UIKitCore                       0x18d8524f4 0x18d0d6000 + 78492047   UIKitCore                       0x18d84fad0 0x18d0d6000 + 78384168   UIKitCore                       0x18d850fe4 0x18d0d6000 + 78438129   UIKitCore                       0x18d851224 0x18d0d6000 + 784438810  UIKitCore                       0x18d17b938 0x18d0d6000 + 67820011  UIKitCore                       0x18d17bcd8 0x18d0d6000 + 67912812  UIKitCore                       0x18d17d354 0x18d0d6000 + 68488413  UIKitCore                       0x18db77584 0x18d0d6000 + 1114662814  UIKitCore                       0x18db7a1f8 0x18d0d6000 + 1115800815  MyApp                           0x104345ce8 EditPageViewController.viewDidLoad() + 2284776 (ContractEditPageViewController.swift:107)16  MyApp                           0x104345fdc @objc EditPageViewController.viewDidLoad() + 2285532 (<compiler-generated>:0)17  UIKitCore                       0x18d53ee50 0x18d0d6000 + 462395218  UIKitCore                       0x18d543408 0x18d0d6000 + 4641800

Any idea how to find out what is going wrong?


Viewing all articles
Browse latest Browse all 7191

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>