app couldn't launch with high frequency and back to home screen randomly

i have an universal app, but recently, i received some iPad user(without any iPhone user) feedback, the app couldn't launch sometimes, user need tap the icon for 6,7times, and after entered the app, and the app will back to home screen randomly.

after log with some user apps, we found some times ios system start call our application delegate from


- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions


and most times start call with

- (void)applicationDidEnterBackground:(UIApplication *)application

- (void)applicationWillEnterForeground:(UIApplication *)application


and when user force quit our app, the method terminate not called.


- (void)applicationWillTerminate:(UIApplication *)application


additional information

our app has background audio play running modes.

the following logs form user device console


Apr 4 17:45:01 lizhide-iPad trustd[103] <Notice>: cert[0]: MissingIntermediate =(leaf)[force]> 0

<SBMainWorkspaceTransitionRequest: 0x28102e980; eventLabel: SBUIApplicationIconLaunchEventLabel; display: Main; source: HomeScreen> {

applicationContext = <SBWorkspaceApplicationSceneTransitionContext: 0x2809537b0; background: NO> entities = {

SBLayoutRolePrimary = <SBDeviceApplicationSceneEntity: 0x281de8640; ID: #our app bundle id#; layoutRole: primary>;

};

}

settings = <SBAppStatusBarSettings: 0x283c37f10; alpha: 0.000000; style: 0x0; legibilitySettings: 0x0; styleOverridesToCancel: 0>;

level = app switcher;

reason = App Switcher Visible;

}

creationDate = 2019\M-e\M-9\M-44\M-f\M^\\M^H4\M-f\M^W\M-% GMT+8 \M-d\M-8\M^K\M-e\M^M\M^H5:45:03;

keepsImageAccessUntilExpiration = NO;

hasGenerationContext = NO;

context = {

contentType = GeneratedDefault;

fullScreen = YES;

referenceSize = {768, 1024};

contentFrame = {{0, 0}, {768, 1024}};

interfaceOrientation = LandscapeLeft;

additionalContext = {

statusBarSettings = <XBStatusBarSettings: 0x283c39d60; hidden: NO; style: 0x0; backgroundActivityEnabled: NO>;

}

}

imageContext = {

scale = 2.0;

opaque = YES;

fileRelativeLocation = none;

}

}

entries =>

0 : <CFString 0x10f5688a0 [0x20a00d610]>{contents = "pid"} = <CFNumber 0x9273b42081cc3255 [0x20a00d610]>{value = +333, type = kCFNumberSInt64Type}

1 : <CFString 0x10f599280 [0x20a00d610]>{contents = "bundleID"} = <CFString 0x10f5535b0 [0x20a00d610]>{contents = "inhouse.fenbi.ape.gwy"}

2 : <CFString 0x1048c2510 [0x20a00d610]>{contents = "HighFrequency"} = <CFBoolean 0x20a0135f0 [0x20a00d610]>{value = true}

}

inactive:1

owner = <BSProcessHandle: 0x10260dc50; SpringBoard:50; valid: YES>;

flags = preventSuspend, preventThrottleDownUI, preventThrottleDownCPU, preventSuspendOnSleep;

}

owner = <BSProcessHandle: 0x10260dc50; SpringBoard:50; valid: YES>;

flags = preventSuspend, preventThrottleDownUI, preventThrottleDownCPU, preventSuspendOnSleep;

}

owner = <BSProcessHandle: 0x102722f80; filecoordinatio:194; valid: YES>;

flags = preventSuspend, preventThrottleDownCPU, preventIdleSleep, preventSuspendOnSleep;

}

flags = preventSuspend, preventThrottleDownCPU, preventIdleSleep, preventSuspendOnSleep;

}

owner = <BSProcessHandle: 0x102722f80; filecoordinatio:194; valid: YES>;

flags = preventSuspend, preventThrottleDownCPU, preventIdleSleep, preventSuspendOnSleep;

}

owner = <BSProcessHandle: 0x102722f80; filecoordinatio:194; valid: YES>;

flags = preventSuspend, preventThrottleDownCPU, preventIdleSleep, preventSuspendOnSleep;

}

[<private> <private>:59280<-><private>:80]

Init: 1, Conn_Time: 50.134ms, Syn's: 1, WR_T: 0/0, RD_T: 0/0, TFO: 0/0/0, ECN: 0/0/0, TS: 1

RTT_Cache: process, rtt_upd: 2, rtt: 62.562ms, rtt_var: 20.812ms rtt_nc: 46.875ms, rtt_var_nc: 17.875ms

ted. Error: (null)

[C1 <private> 192.168.0.102:59278<->IPv4#f7e1179b:80]

Connected Path: satisfied (Path is satisfied), interface: en0, ipv4, dns

Duration: 0.136s, , TCP @0.001s took 0.001s

bytes in/out: 136/237, packets in/out: 2/1, rtt: 0.065s, retransmitted packets: 0, out-of-order packets: 0

[C6 <private> 192.168.0.102:59283<->IPv4#f7e1179b:80]

Connected Path: satisfied (Path is satisfied), interface: en0, ipv4, dns

Duration: 0.110s, , TCP @0.000s took 0.001s

bytes in/out: 136/237, packets in/out: 2/1, rtt: 0.063s, retransmitted packets: 0, out-of-order packets: 0

[C4 <private> 192.168.0.102:59281<->IPv4#f7e1179b:80]

Connected Path: satisfied (Path is satisfied), interface: en0, ipv4, dns

Duration: 0.125s, , TCP @0.000s took 0.000s

bytes in/out: 136/237, packets in/out: 2/1, rtt: 0.064s, retransmitted packets: 0, out-of-order packets: 0

[<private> <private>:59282<-><private>:80]

Init: 1, Conn_Time: 58.544ms, Syn's: 1, WR_T: 0/0, RD_T: 0/0, TFO: 0/0/0, ECN: 0/0/0, TS: 1

RTT_Cache: process, rtt_upd: 2, rtt: 65.593ms, rtt_var: 15.125ms rtt_nc: 54.500ms, rtt_var_nc: 22.875ms

}

owner = <BSProcessHandle: 0x102722f80; filecoordinatio:194; valid: YES>;

flags = preventSuspend, preventThrottleDownCPU, preventIdleSleep, preventSuspendOnSleep;

}

owner = <BSProcessHandle: 0x102722f80; filecoordinatio:194; valid: YES>;

flags = preventSuspend, preventThrottleDownCPU, preventIdleSleep, preventSuspendOnSleep;

}

owner = <BSProcessHandle: 0x10266a400; XC:333; valid: YES>;

flags = preventSuspend, preventIdleSleep, preventSuspendOnSleep;

}

owner = <BSProcessHandle: 0x10266a400; XC:333; valid: YES>;

flags = preventSuspend, preventIdleSleep, preventSuspendOnSleep;

}

tSuspend, preventThrottleDownUI, preventThrottleDownCPU, preventSuspendOnSleep (assertion 0x10273c510 added: (none); removed: preventIdleSleep)

nd[60] <Notice>: [XC:333] Attempting to acquire assertion for XC:333: <BKProcessAssertion: 0x10265cbe0; "Shared Background Assertion 7 for #our app bundle id#" (finishTask:180s); id:\M-b\M^@\M-&22E69D1778F2>

ad powerd[34] <Notice>: Process assertiond.60 Released SystemIsActive "XC:333:194-96EB51E5-37B3-4D46-8573-C667DFCF1329 [File Coordination Claim 692526C5-CA02-4743-9FCC-D5E47930176D] [0x10273c510]" age:00:00:00 id:51539642224 [System: SysAct]

b)[333] <Notice>: nw_connection_report_state_with_handler_locked [C24] reporting state preparing

[<private> <private>:59295<-><private>:80]

Init: 1, Conn_Time: 49.112ms, Syn's: 1, WR_T: 0/0, RD_T: 0/0, TFO: 0/0/0, ECN: 0/0/0, TS: 1

RTT_Cache: process, rtt_upd: 2, rtt: 65.218ms, rtt_var: 33.437ms rtt_nc: 44.500ms, rtt_var_nc: 22.625ms

[C22 <private> 192.168.0.102:59295<->IPv4#f7e1179b:80]

Connected Path: satisfied (Path is satisfied), interface: en0, ipv4, dns

Duration: 0.079s, , TCP @0.000s took 0.000s

bytes in/out: 2983/237, packets in/out: 3/1, rtt: 0.065s, retransmitted packets: 0, out-of-order packets: 0

[<private> <private>:59286<-><private>:80]

Init: 1, Conn_Time: 78.515ms, Syn's: 1, WR_T: 0/0, RD_T: 0/0, TFO: 0/0/0, ECN: 0/0/0, TS: 1

RTT_Cache: process, rtt_upd: 2, rtt: 73.062ms, rtt_var: 22.187ms rtt_nc: 67.250ms, rtt_var_nc: 36.500ms

[C13 <private> 192.168.0.102:59286<->IPv4#f2a6a367:80]

Connected Path: satisfied (Path is satisfied), interface: en0, ipv4, dns

Duration: 0.122s, , TCP @0.000s took 0.000s

bytes in/out: 2983/207, packets in/out: 3/1, rtt: 0.073s, retransmitted packets: 0, out-of-order packets: 0

[<private> <private>:59292<-><private>:80]

Init: 1, Conn_Time: 55.463ms, Syn's: 1, WR_T: 0/0, RD_T: 0/0, TFO: 0/0/0, ECN: 0/0/0, TS: 1

RTT_Cache: process, rtt_upd: 2, rtt: 69.500ms, rtt_var: 25.187ms rtt_nc: 52.625ms, rtt_var_nc: 20.750ms

[C19 <private> 192.168.0.102:59292<->IPv4#f7e1179b:80]

Connected Path: satisfied (Path is satisfied), interface: en0, ipv4, dns

Duration: 0.122s, , TCP @0.000s took 0.000s

bytes in/out: 136/237, packets in/out: 2/1, rtt: 0.069s, retransmitted packets: 0, out-of-order packets: 0

flags = preventSuspend, preventIdleSleep, preventSuspendOnSleep;

}

[<private> <private>:59294<-><private>:80]

Init: 1, Conn_Time: 54.218ms, Syn's: 1, WR_T: 0/0, RD_T: 0/0, TFO: 0/0/0, ECN: 0/0/0, TS: 1

RTT_Cache: process, rtt_upd: 2, rtt: 70.156ms, rtt_var: 23.812ms rtt_nc: 52.500ms, rtt_var_nc: 22.125ms

BKSApplicationStateExtensionKey = 0;

SBApplicationStateDisplayIDKey = "#our app bundle id#";

SBApplicationStateKey = 0;

SBApplicationStateProcessIDKey = 333;

SBApplicationStateRunningReasonsKey = (

{

SBApplicationStateRunningReasonAssertionIdentifierKey = Resume;

SBApplicationStateRunningReasonAssertionReasonKey = 10000;

},

{

SBApplicationStateRunningReasonAssertionIdentifierKey = "Shared Background Assertion 8 for inhouse.fenbi.ape.gwy";

SBApplicationStateRunningReasonAssertionReasonKey = 4;

}

);

}

Symbolication may be possible by manually cleaning up and including the Binary Image section of a full report from this same device -- good luck!

Path: /private/var/containers/Bundle/Application/459B4666-CE0E-4D1C-B64E-C36E15C31FB7/XC.app/XC

OS Version: iPhone OS 12.1.4 (16D57)

Thread 0 Crashed:

0 libsystem_kernel.dylib 0x00000001d9d63104 0x1d9d40000 + 143620

1 libsystem_pthread.dylib 0x00000001d9ddf020 0x1d9ddd000 + 8224

2 libsystem_c.dylib 0x00000001d9cbae1c 0x1d9c63000 + 359964

3 libsystem_c.dylib 0x00000001d9cbb65c 0x1d9c63000 + 362076

4 XC 0x000000010134f250 0x100fa8000 + 3830352

5 ??? 0x5de178e4f4dc4fc5 0 + 6764821040043151301

0 libsystem_pthread.dylib 0x00000001d9debce8 0x1d9ddd000 + 60648

1 libsystem_kernel.dylib 0x00000001d9d5737c 0x1d9d40000 + 95100

2 CoreFoundation 0x00000001da15dad8 0x1da0b1000 + 707288

3 CoreFoundation 0x00000001da158974 0x1da0b1000 + 686452

4 CoreFoundation 0x00000001da1580e0 0x1da0b1000 + 684256

5 Foundation 0x00000001dab4e494 0x1dab46000 + 33940

6 Foundation 0x00000001dab89e84 0x1dab46000 + 278148

7 Foundation 0x00000001dac8123c 0x1dab46000 + 1290812

8 libsystem_pthread.dylib 0x00000001d9de825c 0x1d9ddd000 + 45660

9 libsystem_pthread.dylib 0x00000001d9de81bc 0x1d9ddd000 + 45500

10 libsystem_pthread.dylib 0x00000001d9debcf4 0x1d9ddd000 + 60660

Thread 6:

0 libsystem_kernel.dylib 0x00000001d9d57ea4 0x1d9d40000 + 97956

1 libsystem_kernel.dylib 0x00000001d9d5737c 0x1d9d40000 + 95100

2 CoreFoundation 0x00000001da15dad8 0x1da0b1000 + 707288

3 CoreFoundation 0x00000001da158974 0x1da0b1000 + 686452

4 CoreFoundation 0x00000001da1580e0 0x1da0b1000 + 684256

5 Foundation 0x00000001dab4e494 0x1dab46000 + 33940

6 Foundation 0x00000001dab4e340 0x1dab46000 + 33600

7 UIKitCore 0x00000002071d50c4 0x2067fc000 + 10326212

8 Foundation 0x00000001dac8123c 0x1dab46000 + 1290812

9 libsystem_pthread.dylib 0x00000001d9de825c 0x1d9ddd000 + 45660

10 libsystem_pthread.dylib 0x00000001d9de81bc 0x1d9ddd000 + 45500

11 libsystem_pthread.dylib 0x00000001d9debcf4 0x1d9ddd000 + 60660

0 libsystem_kernel.dylib 0x00000001d9d57ea4 0x1d9d40000 + 97956

1 libsystem_kernel.dylib 0x00000001d9d5737c 0x1d9d40000 + 95100

2 libdispatch.dylib 0x00000001d9bbc2d0 0x1d9ba5000 + 94928

3 libdispatch.dylib 0x00000001d9bbc764 0x1d9ba5000 + 96100

4 libxpc.dylib 0x00000001d9e1fea0 0x1d9e15000 + 44704

5 BaseBoard 0x00000001dc9e8594 0x1dc9e7000 + 5524

6 BaseBoard 0x00000001dc9e8194 0x1dc9e7000 + 4500

7 AssertionServices 0x00000001dca696a4 0x1dca5a000 + 63140

8 AssertionServices 0x00000001dca634f4 0x1dca5a000 + 38132

9 AssertionServices 0x00000001dca66fec 0x1dca5a000 + 53228

10 AssertionServices 0x00000001dca66c18 0x1dca5a000 + 52248

11 libdispatch.dylib 0x00000001d9c056c8 0x1d9ba5000 + 394952

12 libdispatch.dylib 0x00000001d9c06484 <\M-b\M^@\M-&>

Thread 12:

0 libsystem_kernel.dylib 0x00000001d9d62f0c 0x1d9d40000 + 143116

1 libsystem_pthread.dylib 0x00000001d9de0c88 0x1d9ddd000 + 15496

2 Foundation 0x00000001dabbc838 0x1dab46000 + 485432

3 Foundation 0x00000001dab76d80 0x1dab46000 + 200064

4 CoreFoundation 0x00000001da13c83c 0x1da0b1000 + 571452

5 CoreFoundation 0x00000001da13c808 0x1da0b1000 + 571400

6 CoreFoundation 0x00000001da13bcf8 0x1da0b1000 + 568568

7 CoreFoundation 0x00000001da13b9a4 0x1da0b1000 + 567716

8 CoreFoundation 0x00000001da0b3b80 0x1da0b1000 + 11136

9 CoreFoundation 0x00000001da13b430 0x1da0b1000 + 566320

10 Foundation 0x00000001dab4cca0 0x1dab46000 + 27808

11 Pasteboard 0x00000001ef686f6c 0x1ef678000 + 61292

12 libsystem_notify.dylib <\M-b\M^@\M-&>

eFoundation 0x00000001da158974 0x1da0b1000 + 686452

4 CoreFoundation 0x00000001da1580e0 0x1da0b1000 + 684256

5 Foundation 0x00000001dab4e494 0x1dab46000 + 33940

6 Foundation 0x00000001dab89e84 0x1dab46000 + 278148

7 XC 0x0000000101f13474 0x100fa8000 + 16168052

8 Foundation 0x00000001dac8123c 0x1dab46000 + 1290812

9 libsystem_pthread.dylib 0x00000001d9de825c 0x1d9ddd000 + 45660

10 libsystem_pthread.dylib 0x00000001d9de81bc 0x1d9ddd000 + 45500

11 libsystem_pthread.dylib 0x00000001d9debcf4 0x1d9ddd000 + 60660

stateAtExit = <FBProcessState: 0x283fcb900; pid: 333; taskState: Not Running; visibility: Unknown>;

}

SBLayoutRolePrimary = <SBHomeScreenEntity: 0x2827651c0; ID: com.apple.SpringBoard.workspace-entity.builtin.home-screen; layoutRole: primary>;

};

}

42 = "SBAttentionAwareIdleTimerTimeoutContext - expectation: quickWarn";

40 = "SBAttentionAwareIdleTimerTimeoutContext - expectation: warn";

60 = "SBAttentionAwareIdleTimerTimeoutContext - expectation: expiration";

}, configuration generation: 220

42 = "SBAttentionAwareIdleTimerTimeoutContext - expectation: quickWarn";

40 = "SBAttentionAwareIdleTimerTimeoutContext - expectation: warn";

60 = "SBAttentionAwareIdleTimerTimeoutContext - expectation: expiration";

}, configuration generation: 221

settings = <SBAppStatusBarSettings: 0x283c37f10; alpha: 0.000000; style: 0x0; legibilitySettings: 0x0; styleOverridesToCancel: 0>;

level = app switcher;

reason = App Switcher Visible;

}

42 = "SBAttentionAwareIdleTimerTimeoutContext - expectation: quickWarn";

40 = "SBAttentionAwareIdleTimerTimeoutContext - expectation: warn";

60 = "SBAttentionAwareIdleTimerTimeoutContext - expectation: expiration";

}, configuration generation: 222

{name: BatteryLevelPolicy, policyWeight: 1.000, response: {Decision: Can Proceed, Score: 0.78, Rationale: [{batteryLevel == 54}]}}

{name: DeviceActivityPolicy, policyWeight: 10.000, response: {Decision: Can Proceed, Score: 0.27}}

{name: ChargerPluggedInPolicy, policyWeight: 10.000, response: {Decision: Can Proceed, Score: 0.50, Rationale: [{isCharging == 0 AND expectedLongCharge == 0}]}}

] sumScores:28.968971, denominator:41.520000, FinalDecision: Can Proceed FinalScore: 0.697711}

{name: ChargerPluggedInPolicy, policyWeight: 20.000, response: {Decision: Must Not Proceed, Score: 0.00, Rationale: [{isCharging == 0 AND expectedLongCharge == 0}]}}

], FinalDecision: Must Not Proceed}

{name: FileProtectionPolicy, policyWeight: 0.010, response: {Decision: Absolutely Must Not Proceed, Score: 0.00, Rationale: [{classALocked == 0 AND activityFileProtection == <File Protection: Class B>}]}}

{name: ChargerPluggedInPolicy, policyWeight: 20.000, response: {Decision: Must Not Proceed, Score: 0.00, Rationale: [{isCharging == 0 AND expectedLongCharge == 0}]}}

], FinalDecision: Absolutely Must Not Proceed}


i want to know the possbile reasons for this probolem. and how to make our app be normal using, is there some usefull information for us to reslove the probolem. thanks!

Replies

As with all crashes, you need to start with a symbolicated crash log. These lines


4   XC                            0x000000010134f250 0x100fa8000 + 3830352
5   ???                            0x5de178e4f4dc4fc5 0 + 6764821040043151301


will tell you exactly what your code was doing when it crashed, once you get your crash log into Xcode to symbolicate it.

thanks junkpile, and i will try this later.

and some more information for you, i have process the exception handler and no exception received.


NSSetUncaughtExceptionHandler(&uncaughtExceptionHandler);


i think this crash or error is occured in ios app switch or spring board not in our app. because only 0.1% users have this issue, and before issue occured in user device, our app is normal working.

i have process the exception handler and no exception received.

That, in and of itself, is not hugely significant. The uncaught exception handler only sees language exceptions. It’s not invoked if the program crashes due to a machine exception (like accessing unmapped memory).

Moreover, a poorly implemented uncaught exception handler can prevent language exceptions from being reported correctly by the Apple crash report )-:

IMO it’s better to stay out of the crash reporting business and instead let the Apple crash reporter do its job [1]. If you can get an Apple crash report for this crash, please post it here and I’ll take a look.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

[1] If you’re interested in the gory details here, see my Implementing Your Own Crash Reporter post.