Search code examples
ipadcrashios13

IOS13 iPad Settings crashing for already paid app


Our apps on the AppStore have been running for years without any issues. However, since the release of iOS 13, although apps still working fine, but going into

iPad Settings -> MyApp

Crashes and the settings app would end, no issues with previous iOS releases whatsoever.

I looked on the Device Logs from the XCODE Organiser, and can see the following in the logs:

Incident Identifier: DC00F244-958C-407F-BDC9-CFD7D6C3D8C8
CrashReporter Key:   e5b2979fc92fb936e83ef8fdab74fbd1c0707ce3
Hardware Model:      iPad6,4
Process:             Preferences [530]
Path:                /Applications/Preferences.app/Preferences
Identifier:          com.apple.Preferences
Version:             161.2 (1)
Code Type:           ARM-64 (Native)
Role:                Foreground
Parent Process:      launchd [1]
Coalition:           com.apple.Preferences [634]


Date/Time:           2019-10-05 06:18:38.6274 +0100
Launch Time:         2019-10-05 06:18:17.3730 +0100
OS Version:          iPhone OS 13.1.2 (17A860)
Release Type:        User
Baseband Version:    7.00.01
Report Version:      104

Exception Type:  EXC_BREAKPOINT (SIGTRAP)
Exception Codes: 0x0000000000000001, 0x00000001a581fefc
Termination Signal: Trace/BPT trap: 5
Termination Reason: Namespace SIGNAL, Code 0x5
Terminating Process: exc handler [530]
Triggered by Thread:  0

Thread 0 name:  Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0   libswiftCore.dylib              0x00000001a581fefc specialized _assertionFailure+ 2154236 (_:_:file:line:flags:) + 440
1   libswiftCore.dylib              0x00000001a581fefc specialized _assertionFailure+ 2154236 (_:_:file:line:flags:) + 440
2   libswiftCore.dylib              0x00000001a563b64c _assertionFailure+ 169548 (_:_:file:line:flags:) + 32
3   SettingsUIKitPrivate            0x00000001bfce0c24 0x1bfcda000 + 27684
4   SettingsUIKitPrivate            0x00000001bfce0fd4 0x1bfcda000 + 28628
5   SwiftUI                         0x00000001cd28d86c Binding.init+ 6629484 (get:set:) + 144
6   SettingsUIKitPrivate            0x00000001bfcdf654 0x1bfcda000 + 22100
7   SettingsUIKitPrivate            0x00000001bfcdca54 0x1bfcda000 + 10836
8   SettingsUIKitPrivate            0x00000001bfcdc44c 0x1bfcda000 + 9292
9   SwiftUI                         0x00000001cccf88e4 DynamicPropertyBody.update+ 776420 (context:) + 1768
10  SwiftUI                         0x00000001cccf9070 protocol witness for static UntypedAttribute._update+ 778352 (_:graph:attribute:) in conformance DynamicPropertyBody<A> + 36
11  AttributeGraph                  0x00000001c248e458 partial apply + 28
12  AttributeGraph                  0x00000001c2476a60 AG::Graph::UpdateStack::update+ 14944 () + 984
13  AttributeGraph                  0x00000001c2476d24 AG::Graph::update_attribute+ 15652 (unsigned int, bool) + 372
14  AttributeGraph                  0x00000001c2479e9c AG::Graph::value_ref+ 28316 (AG::attribute_t, AGTypeID, bool*) + 116
15  AttributeGraph                  0x00000001c24815ac AG::Graph::EntryExit::update_entry+ 58796 () const + 64
16  AttributeGraph                  0x00000001c2476a60 AG::Graph::UpdateStack::update+ 14944 () + 984
17  AttributeGraph                  0x00000001c2476d24 AG::Graph::update_attribute+ 15652 (unsigned int, bool) + 372
18  AttributeGraph                  0x00000001c2479e9c AG::Graph::value_ref+ 28316 (AG::attribute_t, AGTypeID, bool*) + 116
19  AttributeGraph                  0x00000001c24879e4 AGGraphGetValue + 48
20  SwiftUI                         0x00000001cce25c20 ViewGraph.sizeThatFits+ 2010144 (_:) + 100
21  SwiftUI                         0x00000001cd2e0520 specialized ListItemHost<>.hostSizeThatFits+ 6968608 (width:) + 120
22  SwiftUI                         0x00000001ccefb250 @objc ListCoreCellHost.sizeThatFits+ 2884176 (_:) + 48
23  UIKitCore                       0x000000019c666b98 -[UITableViewCell systemLayoutSizeFittingSize:withHorizontalFittingPriority:verticalFittingPriority:] + 592
24  UIKitCore                       0x000000019c6dce38 -[UITableView _heightForCell:atIndexPath:] + 436
25  UIKitCore                       0x000000019c6c544c __53-[UITableView _configureCellForDisplay:forIndexPath:]_block_invoke + 2568
26  UIKitCore                       0x000000019c971d08 +[UIView+ 15129864 (Animation) performWithoutAnimation:] + 96
27  UIKitCore                       0x000000019c6c495c -[UITableView _configureCellForDisplay:forIndexPath:] + 248
28  UIKitCore                       0x000000019c6d5a04 -[UITableView _createPreparedCellForGlobalRow:withIndexPath:willDisplay:] + 796
29  UIKitCore                       0x000000019c6a338c -[UITableView _updateVisibleCellsNow:] + 2608
30  UIKitCore                       0x000000019c6c04b0 -[UITableView layoutSubviews] + 160
31  SwiftUI                         0x00000001ccef4438 UpdateCoalescingTableView.layoutSubviews+ 2855992 () + 56
32  SwiftUI                         0x00000001ccef45e4 @objc UpdateCoalescingTableView.layoutSubviews+ 2856420 () + 28
33  UIKitCore                       0x000000019c97f270 -[UIView+ 15184496 (CALayerDelegate) layoutSublayersOfLayer:] + 2140
34  QuartzCore                      0x000000019ee6b5f8 -[CALayer layoutSublayers] + 284
35  QuartzCore                      0x000000019ee6fe28 CA::Layer::layout_if_needed+ 1396264 (CA::Transaction*) + 480
36  QuartzCore                      0x000000019ee7b894 CA::Layer::layout_and_display_if_needed+ 1443988 (CA::Transaction*) + 136
37  QuartzCore                      0x000000019edc49f0 CA::Context::commit_transaction+ 694768 (CA::Transaction*, double) + 304
38  QuartzCore                      0x000000019edee890 CA::Transaction::commit+ 866448 () + 676
39  QuartzCore                      0x000000019edef284 CA::Transaction::observer_callback+ 868996 (__CFRunLoopObserver*, unsigned long, void*) + 92
40  CoreFoundation                  0x0000000198463c48 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 32
41  CoreFoundation                  0x000000019845eb34 __CFRunLoopDoObservers + 416
42  CoreFoundation                  0x000000019845f100 __CFRunLoopRun + 1308
43  CoreFoundation                  0x000000019845e8bc CFRunLoopRunSpecific + 464
44  GraphicsServices                0x00000001a22ca328 GSEventRunModal + 104
45  UIKitCore                       0x000000019c4f46d4 UIApplicationMain + 1936
46  Preferences                     0x0000000104869974 0x104860000 + 39284
47  libdyld.dylib                   0x00000001982e9460 start + 4

Thread 1:
0   libsystem_pthread.dylib         0x0000000198206ad8 start_wqthread + 0

Thread 2:
0   libsystem_pthread.dylib         0x0000000198206ad8 start_wqthread + 0

Thread 3 name:  com.apple.uikit.eventfetch-thread
Thread 3:
0   libsystem_kernel.dylib          0x00000001982bd5f4 mach_msg_trap + 8
1   libsystem_kernel.dylib          0x00000001982bca60 mach_msg + 72
2   CoreFoundation                  0x0000000198464068 __CFRunLoopServiceMachPort + 216
3   CoreFoundation                  0x000000019845f188 __CFRunLoopRun + 1444
4   CoreFoundation                  0x000000019845e8bc CFRunLoopRunSpecific + 464
5   Foundation                      0x000000019879e994 -[NSRunLoop+ 31124 (NSRunLoop) runMode:beforeDate:] + 228
6   Foundation                      0x000000019879e874 -[NSRunLoop+ 30836 (NSRunLoop) runUntilDate:] + 88
7   UIKitCore                       0x000000019c58c49c -[UIEventFetcher threadMain] + 152
8   Foundation                      0x00000001988cf0b0 __NSThread__start__ + 848
9   libsystem_pthread.dylib         0x00000001982031ec _pthread_start + 124
10  libsystem_pthread.dylib         0x0000000198206aec thread_start + 8

Thread 4:
0   libsystem_pthread.dylib         0x0000000198206ad8 start_wqthread + 0

Thread 5:
0   libsystem_pthread.dylib         0x0000000198206ad8 start_wqthread + 0

Thread 6 name:  com.apple.NSURLConnectionLoader
Thread 6:
0   libsystem_kernel.dylib          0x00000001982bd5f4 mach_msg_trap + 8
1   libsystem_kernel.dylib          0x00000001982bca60 mach_msg + 72
2   CoreFoundation                  0x0000000198464068 __CFRunLoopServiceMachPort + 216
3   CoreFoundation                  0x000000019845f188 __CFRunLoopRun + 1444
4   CoreFoundation                  0x000000019845e8bc CFRunLoopRunSpecific + 464
5   CFNetwork                       0x000000019b6d9e68 0x19b6d8000 + 7784
6   Foundation                      0x00000001988cf0b0 __NSThread__start__ + 848
7   libsystem_pthread.dylib         0x00000001982031ec _pthread_start + 124
8   libsystem_pthread.dylib         0x0000000198206aec thread_start + 8

Thread 0 crashed with ARM Thread State (64-bit):
    x0: 0xe000000000000000   x1: 0x0000000280915800   x2: 0x0000000000000007   x3: 0x00000001981ce0dc
    x4: 0x0000000000000000   x5: 0x000000016b59a5f0   x6: 0x0000000000000072   x7: 0x0000000000000c70
    x8: 0x00000000dfc24834   x9: 0x000000000000007f  x10: 0x0000000000000031  x11: 0x00000000000007fb
   x12: 0x00000000000007fd  x13: 0x0000000000000000  x14: 0x00000000dfe25000  x15: 0x000000000000004a
   x16: 0x0000000080000000  x17: 0x000000005fe00000  x18: 0x0000000000000000  x19: 0x00000001bfcfd020
   x20: 0x0000000000000002  x21: 0x0000000000000000  x22: 0x00000000000000a8  x23: 0x0000000000000000
   x24: 0xe000000000000000  x25: 0x000000000000000b  x26: 0x0000000000000000  x27: 0x0000000000000095
   x28: 0x00000001bfce0fbc   fp: 0x000000016b59a790   lr: 0x00000001a581fefc
    sp: 0x000000016b59a710   pc: 0x00000001a581fefc cpsr: 0x60000000
   esr: 0xf2000001  Address size fault

I'm scratching my head on this one, the app works fine, just the settings having this issue.

I have a plan about how to diagnose and fix and hopefully should resolve soon but wondered if anyone has seen this yet?

Thanks


Solution

  • Finally, after few hours of going through the settings, code, etc, I finally fixed it.

    The approach was to:

    1) Edit my APP setting's info.plist file (as text) and take out all sections into text editor, the file almost becomes blank.

    2) Re-compile and run on the iPad -> STOP APP -> Go to Settings -> Click on the APP, it now works fine without my settings, so, I thought something must have caused all this.

    3) Started pasting back part-by-part into the info.plist file until I finally got the offending section, which was below:

        <dict>
            <key>AutocapitalizationType</key>
            <string>None</string>
            <key>AutocorrectionType</key>
            <string>No</string>
            <key>DefaultValue</key>
            <string>8101</string>
            <key>IsSecure</key>
            <string>No</string>
            <key>Key</key>
            <string>Admin_iTaxi Server Port</string>
            <key>KeyboardType</key>
            <string>NumberPad</string>
            <key>Title</key>
            <string>Server Port                </string>
            <key>Type</key>
            <string>PSTextFieldSpecifier</string>
        </dict>
    

    4) Looked very strange and bizarre, ... I mean what could possibly be wrong with the above chunk?!... and why was this working on all iOSes until the latest iOS13!?...

    5) Checked all spelling, re-ordered the list to make it similar to another one that does work, changed the keyboard type, other items,... started-Stopped, checked settings, same thing,... still crashing!...

    6) Finally, I changed the variable name from "Admin_iTaxi Server Port" to "Admin_iTaxi Server XXXPort", re-compiled, and it worked... hmmm... why!?...

    7) Went back into the startup code, and noticed that I am setting the variables (if they don't exists) with the following:

    if (!IsConfigKeyExist(@"Admin_iTaxi Server Port"))
    {
            TempServerPortAdmin = 8102;
            [[NSUserDefaults standardUserDefaults] setInteger:TempServerPortAdmin forKey:@"Admin_iTaxi Server Port"];
    }
    

    8) I then thought, the info.plist file has KEYs and TYPEs, all are set as , can't remember setting any or etc, therefore.

    9) Changed the code above into:

    if (!IsConfigKeyExist(@"Admin_iTaxi Server Port")) { TempServerPortAdmin = 8102; [[NSUserDefaults standardUserDefaults] setValue:[NSString stringWithFormat:@"%li", TempServerPortAdmin] forKey:@"Admin_iTaxi Server Port"]; }

    10) Restored the original variable name on the info.plist, start-stop-check, ... Eureeka,.. it now works...

    Conclusion: somehow down the line Apple in their wisdom decided to crash the settings app when they read an Integer into a String variable... why!?... I have no idea, but the fix (as mentioned above), is NOT to store your settings as "Integer" and infect only store as "String" especially if you are going to use these settings in your info.plist file.

    This solves the problem of the app's settings crashing with EXC_BREAKPOINT (SIGTRAP)

    I hope this helps.

    Good luck!