Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

device/platform name fetch crash fix #129

Closed

Conversation

adithyareddyZ
Copy link

This is in reference to this thread : #103

Based on the stack trace below:

Crashed: com.apple.main-thread
0 libobjc.A.dylib 0x1ac8b0ed0 objc_retain + 16
1 CoreFoundation 0x19775eeb4 -[__NSDictionaryM setObject:forKeyedSubscript:] + 388
2 CleverTapSDK 0x1054198a0 -[CleverTap generateAppFields] + 1080 (CleverTap.m:1080)
3 CleverTapSDK 0x10541b260 -[CleverTap recordAppLaunched:] + 1341 (CleverTap.m:1341)
4 CleverTapSDK 0x10541ae9c -[CleverTap _appEnteredForeground] + 1300 (CleverTap.m:1300)
5 CleverTapSDK 0x10541ac58 -[CleverTap _appEnteredForegroundWithLaunchingOptions:] + 1278 (CleverTap.m:1278)
6 CleverTapSDK 0x105427868 -[CleverTap notifyApplicationLaunchedWithOptions:] + 3259 (CleverTap.m:3259)
7 CleverTapSDK 0x105414470 +[CleverTap onDidFinishLaunchingNotification:] + 296 (CleverTap.m:296)
8 CoreFoundation 0x1977d69a0 CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER + 28
9 CoreFoundation 0x1977d6948 ___CFXRegistrationPost_block_invoke + 52
10 CoreFoundation 0x1977d5eb0 _CFXRegistrationPost + 440
11 CoreFoundation 0x1977d5870 _CFXNotificationPost + 716
12 Foundation 0x198a9c4bc -[NSNotificationCenter postNotificationName:object:userInfo:] + 64
13 UIKitCore 0x19a22cb94 -[UIApplication _callInitializationDelegatesWithActions:forCanvas:payload:fromOriginatingProcess:] + 3348
14 UIKitCore 0x19a232cec -[UIApplication _runWithMainScene:transitionContext:completion:] + 1244
15 UIKitCore 0x199888c74 -[_UISceneLifecycleMultiplexer completeApplicationLaunchWithFBSScene:transitionContext:] + 152
16 UIKitCore 0x199df6f9c _UIScenePerformActionsWithLifecycleActionMask + 112
17 UIKitCore 0x19988980c __101-[_UISceneLifecycleMultiplexer _evalTransitionToSettings:fromSettings:forceExit:withTransitionStore:]_block_invoke + 224
18 UIKitCore 0x1998892cc -[_UISceneLifecycleMultiplexer _performBlock:withApplicationOfDeactivationReasons:fromReasons:] + 484
19 UIKitCore 0x19988961c -[_UISceneLifecycleMultiplexer _evalTransitionToSettings:fromSettings:forceExit:withTransitionStore:] + 768
20 UIKitCore 0x199888e58 -[_UISceneLifecycleMultiplexer uiScene:transitionedFromState:withTransitionContext:] + 340
21 UIKitCore 0x1998913a4 __186-[_UIWindowSceneFBSSceneTransitionContextDrivenLifecycleSettingsDiffAction _performActionsForUIScene:withUpdatedFBSScene:settingsDiff:fromSettings:transitionContext:lifecycleActionType:]_block_invoke + 196
22 UIKitCore 0x199d0360c +[BSAnimationSettings(UIKit) tryAnimatingWithSettings:actions:completion:] + 892
23 UIKitCore 0x199e0f6c4 _UISceneSettingsDiffActionPerformChangesWithTransitionContext + 272
24 UIKitCore 0x19989109c -[_UIWindowSceneFBSSceneTransitionContextDrivenLifecycleSettingsDiffAction _performActionsForUIScene:withUpdatedFBSScene:settingsDiff:fromSettings:transitionContext:lifecycleActionType:] + 384
25 UIKitCore 0x1996b85a0 __64-[UIScene scene:didUpdateWithDiff:transitionContext:completion:]_block_invoke + 776
26 UIKitCore 0x1996b6f14 -[UIScene _emitSceneSettingsUpdateResponseForCompletion:afterSceneUpdateWork:] + 256
27 UIKitCore 0x1996b81c8 -[UIScene scene:didUpdateWithDiff:transitionContext:completion:] + 248
28 UIKitCore 0x19a230e8c -[UIApplication workspace:didCreateScene:withTransitionContext:completion:] + 572
29 UIKitCore 0x199d2ce38 -[UIApplicationSceneClientAgent scene:didInitializeWithEvent:completion:] + 388
30 FrontBoardServices 0x1a75e23bc -[FBSScene _callOutQueue_agent_didCreateWithTransitionContext:completion:] + 432
31 FrontBoardServices 0x1a760dd04 __94-[FBSWorkspaceScenesClient createWithSceneID:groupID:parameters:transitionContext:completion:]_block_invoke.200 + 128
32 FrontBoardServices 0x1a75f14a0 -[FBSWorkspace _calloutQueue_executeCalloutFromSource:withBlock:] + 240
33 FrontBoardServices 0x1a760d9c8 __94-[FBSWorkspaceScenesClient createWithSceneID:groupID:parameters:transitionContext:completion:]_block_invoke + 372
34 libdispatch.dylib 0x19746ddb0 _dispatch_client_callout + 20
35 libdispatch.dylib 0x197471738 _dispatch_block_invoke_direct + 268
36 FrontBoardServices 0x1a7636250 FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK + 48
37 FrontBoardServices 0x1a7635ee0 -[FBSSerialQueue _targetQueue_performNextIfPossible] + 448
38 FrontBoardServices 0x1a7636434 -[FBSSerialQueue _performNextFromRunLoopSource] + 32
39 CoreFoundation 0x1977f576c CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION + 28
40 CoreFoundation 0x1977f5668 __CFRunLoopDoSource0 + 208
41 CoreFoundation 0x1977f4960 __CFRunLoopDoSources0 + 268
42 CoreFoundation 0x1977eea8c __CFRunLoopRun + 824
43 CoreFoundation 0x1977ee21c CFRunLoopRunSpecific + 600
44 GraphicsServices 0x1af3b8784 GSEventRunModal + 164
45 UIKitCore 0x19a22eee8 -[UIApplication _run] + 1072
46 UIKitCore 0x19a23475c UIApplicationMain + 168
47 Zomato 0x10416b944 main + 15 (main.m:15)
48 libdyld.dylib 0x1974ae6b0 start + 4

Looks like when the struct utsname systemInfo is referenced outside of its scope, it seems to get de-allocated in some rare conditions.

Hence, to overcome direct usage of struct.property outside of the scope. Created a key value map and the value is wrapped inside a string which is then passed around.

@Aditi3 Aditi3 self-requested a review June 1, 2021 10:22
@Aditi3
Copy link
Contributor

Aditi3 commented Jun 2, 2021

Hi @adithyareddyZ

Thank you for submitting the Pull Request. Below are my thoughts about the changes suggested by you:

  1. CleverTap SDK sends the Model key with the value of the machine name, not the device name. For example, the value of key Model send by us in request payload for device iPhone 11 is iPhone12,1. Can you please accommodate that in your PR?

  2. Looks like the build is failing, can you have a look at it?

@adithyareddyZ
Copy link
Author

Hi @Aditi3

  1. Got it, just curious, is there a reason you guys prefer Model name against the Device name? Device name seems more readable isn't it?

example:
Model name : @"iPhone12,5"
Device name: @"iPhone 11 Pro Max"

  1. Yup, my bad, I should have checked. I have corrected and pushed it, please let me know if there are any other issues.

@icodebuster
Copy link

@adithyareddyZ

The utsname struct provides you with the machine info in this format iPhone10,3 now if you want to get a human readable name then you will need to maintain a dictionary/method with each iOS SDK provided machine info and its equivalent readable name (Reference). This can be done, but the real problem is whenever in the future if Apple releases a new device then we will have to update this dictionary/method and then the clients developer has to upgrade the SDK to get the changes reflected.

The best practice would be to maintain the readable model names on the server side and the SDK captures the original Machine info provided by the iOS, pass it to the server and let the server do its magic to show the readable data on the dashboards.

Hope this helps.

@Aditi3
Copy link
Contributor

Aditi3 commented Jul 2, 2021

@adithyareddyZ Thank you for submitting the Pull Request. However, we won't be able to merge the proposed solution since it changes the logic related tomodel implementation at our end.

Please follow the progress at #103

@Aditi3 Aditi3 closed this Jul 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants