microsoftconnect / ms-intune-app-sdk-ios

Intune App SDK for iOS enables data protection and mobile app management features in iOS mobile apps with Microsoft Intune
91 stars 27 forks source link

App will crash when launch from Carplay with PIN required #488

Open Chengruihh opened 2 weeks ago

Chengruihh commented 2 weeks ago

Describe the bug: We have detected a reproducible crash. When user connects his phone to Carplay, and launch our app directly from Carplay screen, meanwhile, if the user is required to enter PIN, then the app will crash.

Application Specific Information:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[CPTemplateApplicationScene interfaceOrientation]: unrecognized selector sent to instance 0x1192afa80'

We think the SDK was trying to call the PIN window/scene but actually called to the Carplay scene instance, because it is launched from Carplay, and caused the unrecognized selector exception.

To Reproduce Steps to reproduce the behavior:

  1. Apply require PIN to a user
  2. Connect phone to Carplay
  3. Launch app directly from Carplay when the PIN required
  4. App crash

Expected behavior: App should not crash.

Screenshots and logs:

Application Specific Information:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[CPTemplateApplicationScene interfaceOrientation]: unrecognized selector sent to instance 0x11ca29400'
Thread 0 Crashed:
0   CoreFoundation                  0x00000001a1958f20 __exceptionPreprocess + 164
1   libobjc.A.dylib                 0x00000001997df2b8 objc_exception_throw + 60
2   CoreFoundation                  0x00000001a1a62480 +[NSObject(NSObject) _copyDescription] + 0
3   UIKitCore                       0x00000001a4a359ac -[UIResponder doesNotRecognizeSelector:] + 260
4   CoreFoundation                  0x00000001a18f5fb4 ___forwarding___ + 1572
5   CoreFoundation                  0x00000001a18f58d0 _CF_forwarding_prep_0 + 96
6   IntuneMAMSwift                  0x0000000109031768 cmarInternalIsDeviceJailbroken + 100888
7   IntuneMAMSwift                  0x0000000109031548 cmarInternalIsDeviceJailbroken + 100344
8   IntuneMAMSwift                  0x00000001090313c8 cmarInternalIsDeviceJailbroken + 99960
9   IntuneMAMSwift                  0x00000001090310cc cmarInternalIsDeviceJailbroken + 99196
10  IntuneMAMSwift                  0x0000000109033080 cmarInternalIsDeviceJailbroken + 107312
11  IntuneMAMSwift                  0x0000000109030364 cmarInternalIsDeviceJailbroken + 95764
12  CoreFoundation                  0x00000001a192678c __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 148
13  CoreFoundation                  0x00000001a19266a8 ___CFXRegistrationPost_block_invoke + 88
14  CoreFoundation                  0x00000001a19265f0 _CFXRegistrationPost + 440
15  CoreFoundation                  0x00000001a1924bb8 _CFXNotificationPost + 728
16  Foundation                      0x00000001a07b2254 -[NSNotificationCenter postNotificationName:object:userInfo:] + 92
17  UIKitCore                       0x00000001a3f65be8 -[UIApplication _sendWillEnterForegroundCallbacks] + 212
18  UIKitCore                       0x00000001a3f61ffc __101-[_UISceneLifecycleMultiplexer _evalTransitionToSettings:fromSettings:forceExit:withTransitionStore:]_block_invoke_2 + 1272
19  UIKitCore                       0x00000001a3d8f708 _UIScenePerformActionsWithLifecycleActionMask + 112
20  UIKitCore                       0x00000001a3f62488 __101-[_UISceneLifecycleMultiplexer _evalTransitionToSettings:fromSettings:forceExit:withTransitionStore:]_block_invoke + 216
21  UIKitCore                       0x00000001a3f62208 -[_UISceneLifecycleMultiplexer _performBlock:withApplicationOfDeactivationReasons:fromReasons:] + 332
22  UIKitCore                       0x00000001a3cf1360 -[_UISceneLifecycleMultiplexer _evalTransitionToSettings:fromSettings:forceExit:withTransitionStore:] + 608
23  UIKitCore                       0x00000001a3cbe594 -[_UISceneLifecycleMultiplexer uiScene:transitionedFromState:withTransitionContext:] + 248
24  UIKitCore                       0x00000001a3cbdebc __186-[_UIWindowSceneFBSSceneTransitionContextDrivenLifecycleSettingsDiffAction _performActionsForUIScene:withUpdatedFBSScene:settingsDiff:fromSettings:transitionContext:lifecycleActionType:]_block_invoke + 148
25  UIKitCore                       0x00000001a3cbd868 +[BSAnimationSettings(UIKit) tryAnimatingWithSettings:fromCurrentState:actions:completion:] + 736
26  UIKitCore                       0x00000001a3cbcea8 _UISceneSettingsDiffActionPerformChangesWithTransitionContextAndCompletion + 224
27  UIKitCore                       0x00000001a3d90c80 -[_UIWindowSceneFBSSceneTransitionContextDrivenLifecycleSettingsDiffAction _performActionsForUIScene:withUpdatedFBSScene:settingsDiff:fromSettings:transitionContext:lifecycleActionType:] + 316
28  UIKitCore                       0x00000001a3d8f4b8 __64-[UIScene scene:didUpdateWithDiff:transitionContext:completion:]_block_invoke.226 + 612
29  UIKitCore                       0x00000001a3d8ee2c -[UIScene _emitSceneSettingsUpdateResponseForCompletion:afterSceneUpdateWork:] + 244
30  UIKitCore                       0x00000001a3e59f48 -[UIScene scene:didUpdateWithDiff:transitionContext:completion:] + 244
31  UIKitCore                       0x00000001a3e59b28 -[UIApplicationSceneClientAgent scene:handleEvent:withCompletion:] + 336
32  FrontBoardServices              0x00000001ba6d26e4 -[FBSScene updater:didUpdateSettings:withDiff:transitionContext:completion:] + 660
33  FrontBoardServices              0x00000001ba6e2844 __94-[FBSWorkspaceScenesClient _queue_updateScene:withSettings:diff:transitionContext:completion:]_block_invoke_2 + 152
34  FrontBoardServices              0x00000001ba6e26cc -[FBSWorkspace _calloutQueue_executeCalloutFromSource:withBlock:] + 168
35  FrontBoardServices              0x00000001ba6e77fc __94-[FBSWorkspaceScenesClient _queue_updateScene:withSettings:diff:transitionContext:completion:]_block_invoke + 344
36  libdispatch.dylib               0x00000001a97fedd4 _dispatch_client_callout + 20
37  libdispatch.dylib               0x00000001a980286c _dispatch_block_invoke_direct + 288
38  FrontBoardServices              0x00000001ba6e3d58 __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 52
39  FrontBoardServices              0x00000001ba6e3cd8 -[FBSMainRunLoopSerialQueue _targetQueue_performNextIfPossible] + 240
40  FrontBoardServices              0x00000001ba6e3bb0 -[FBSMainRunLoopSerialQueue _performNextFromRunLoopSource] + 28
41  CoreFoundation                  0x00000001a192b834 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 28
42  CoreFoundation                  0x00000001a192b7c8 __CFRunLoopDoSource0 + 176
43  CoreFoundation                  0x00000001a19292f8 __CFRunLoopDoSources0 + 340
44  CoreFoundation                  0x00000001a1928484 __CFRunLoopRun + 828
45  CoreFoundation                  0x00000001a1927cd8 CFRunLoopRunSpecific + 608
46  GraphicsServices                0x00000001e63751a8 GSEventRunModal + 164
47  UIKitCore                       0x00000001a3f61ae8 -[UIApplication _run] + 888
48  UIKitCore                       0x00000001a4015d98 UIApplicationMain + 340
49  IntuneMAMSwift                  0x0000000108fd35b4 cmarDeviceComplianceEnabled + 2128208

Smartphone (please complete the following information):

Intune App SDK for iOS (please complete the following information):

Additional context: Actually it will not crash with older version such as 19.3.1. It happens after we updated SDK version to 19.7.0 and 19.7.1

kanishkaBagga commented 6 days ago

@Chengruihh - we will need more information, would you enable Intune diagnostic console, then get below:

Repo video MAM logs Crash logs MAM policy details

iceloveboa commented 1 day ago

@kanishkaBagga I guess The crash reason is Our app only has one UIScene which is CPTemplateApplicationScene when started from CarPlay. But ms intune code call the [UIScene interfaceOrientation] But CPTemplateApplicationScene didn't has the interfaceOrientation function.