iOS crashed randomly (18.5 version of SDK).
Stacktrace:Â
Thread 25 name:
Thread 25 name:
Thread 25 Crashed:
0  libsystem_kernel.dylib        0x00000001e3b572d4 __pthread_kill + 8 (:-1)
1  libsystem_pthread.dylib       0x000000021d08d59c pthread_kill + 268 (pthread.c:1721)
2  libsystem_c.dylib          0x000000019a2a0b08 abort + 128 (abort.c:122)
3  libsystem_malloc.dylib        0x00000001a2a54b74 malloc_vreport + 896 (malloc_printf.c:251)
4  libsystem_malloc.dylib        0x00000001a2a7dc00 malloc_zone_error + 100 (malloc_printf.c:319)
5  libsystem_malloc.dylib        0x00000001a2a72c30 nanov2_guard_corruption_detected + 44 (nanov2_malloc.c:2496)
6  libsystem_malloc.dylib        0x00000001a2a53c6c nanov2_allocate_outlined + 460 (nanov2_malloc.c:2989)
7  libsystem_malloc.dylib        0x00000001a2a53a18 nanov2_calloc_type + 568 (nanov2_malloc.c:1247)
8  libobjc.A.dylib           0x000000018f9a8b04 class_createInstance + 72 (objc-runtime-new.mm:9183)
9  CoreFoundation            0x000000019243d670 __CFAllocateObject + 20 (NSObject.m:706)
10  CoreFoundation            0x000000019243d2b8 __NSDictionaryM_new + 136 (NSDictionaryM.m:359)
11  Foundation              0x0000000191039ccc _encodeObject + 980 (NSKeyedArchiver.m:1252)
12  Foundation              0x0000000191039734 -0NSKeyedArchiver _encodeArrayOfObjects:forKey:] + 460 (NSKeyedArchiver.m:1300)
13  Foundation              0x0000000191202ee4 -vNSSet(NSSet) encodeWithCoder:] + 384 (NSSet_Foundation.m:42)
14  Foundation              0x0000000191039d94 _encodeObject + 1180 (NSKeyedArchiver.m:1255)
15  Intercom               0x000000010341f000 - ICMMetric encodeWithCoder:] + 92
16  Foundation              0x0000000191039d94 _encodeObject + 1180 (NSKeyedArchiver.m:1255)
17  Foundation              0x00000001910d7a8c +
19  Intercom               0x000000010341ed84 +KICMMetric saveMetrics:] + 96
20  libdispatch.dylib          0x000000019a1e5248 _dispatch_call_block_and_release + 32 (init.c:1549)
21  libdispatch.dylib          0x000000019a1e6fa8 _dispatch_client_callout + 20 (object.m:576)
22  libdispatch.dylib          0x000000019a1f9094 _dispatch_root_queue_drain + 860 (queue.c:7331)
23  libdispatch.dylib          0x000000019a1f96c4 _dispatch_worker_thread2 + 156 (queue.c:7399)
24  libsystem_pthread.dylib       0x000000021d088644 _pthread_wqthread + 228 (pthread.c:2709)
25  libsystem_pthread.dylib       0x000000021d086474 start_wqthread + 8 (:-1)
How to disable metrics saving to avoid this crash? Can you fix it?
hi ​
Â
You’re experiencing a crash in the Intercom iOS SDK (18.5) related to metrics saving. The stack trace indicates a failure when ICMMetric saveMetrics: attempts to persist data, specifically during NSKeyedArchiver serialization.
Â
The issue is likely due to:
1. Corrupt data being saved in metrics.
2. Thread safety issue when multiple threads attempt to write metrics simultaneously.
3. Memory corruption (nanov2_guard_corruption_detected) related to malloc.
Â
To mitigate the crash, you can disable metrics saving.
Workaround: Disable Metrics Saving
Â
You can prevent ICMMetric from persisting data by disabling logging in Intercom. Add the following code during SDK initialization:
Â
Option 1: Disable Logs via Intercom API
Intercom.setLogLevel(.none) // Prevents unnecessary logging
This reduces metric logging but may not fully prevent saving.
Â
Option 2: Disable Metrics via User Defaults (More Reliable)
Â
Intercom does not provide a direct way to disable metrics persistence, but you can override the UserDefaults storage key for metrics by injecting an invalid or empty value.
UserDefaults.standard.set(nil, forKey: "ICMMetricSavedKey")
UserDefaults.standard.synchronize()
This will prevent the SDK from retrieving old metric data and attempting to save it.
Â
Option 3: Patch the SDK (If You Control the Source)
Â
If you have access to the SDK source, you can monkey-patch ICMMetric to avoid writing to disk:
• Locate +iICMMetric saveMetrics:] in the SDK.
• Replace the contents with:
+ (void)saveMetrics:(NSArray *)metrics {
return; // No-op to prevent crashes
}
Â
This will completely disable metric persistence.
Permanent Fix
Â
Since this issue appears in SDK 18.5, we recommend updating to the latest SDK version at the moment it is 18.6.1 where this might have been resolved.
1. Check for an updated version of Intercom iOS SDK:
pod outdated Intercom
Â
2. If an update is available, upgrade:
pod update Intercom
Â
If the issue persists after updating, please let us know. We can escalate this to the Intercom engineering team for a deeper investigation.
Reply
Join the Intercom Community 🎉
Already have an account? Login
Login to the community
No account yet? Create an account
Intercom Customers and Employees
Log in with SSOEnter your E-mail address. We'll send you an e-mail with instructions to reset your password.