Ask OfflineW!
Because every question deserves an answer

Sponsored

Practica
MCQ Practice — Offline
Sharpen your skills with quick, offline-ready MCQ tests for instant revision and exam prep.
  • 500+ curated MCQs
  • Timed quizzes
  • Instant feedback
Start Practicing
No signup offlinew.com/practica

Related

  • Practice MCQ
  • Tutorials
JSONEncoder.encode causes stack overflow crash (thread_chkstk_darwin) on iOS 26.3.1 only — deeply nested Codable model
15:57 05 May 2026

My app crashes on iOS 26.3.1 (a) only (cannot reproduce on earlier versions) with the following crash type:

Crashed: com.apple.main-thread

0 libsystem_pthread.dylib thread_chkstk_darwin + 60

1 libsystem_pthread.dylib ___chkstk_darwin + 60

2 libswiftCore.dylib KeyedEncodingContainerProtocol.encodeIfPresent(_:forKey:) + 272

3 Foundation + 36

4 libswiftCore.dylib _KeyedEncodingContainerBox.encodeIfPresent(_:forKey:) + 372

5 libswiftCore.dylib KeyedEncodingContainer.encodeIfPresent(_:forKey:) + 76

...

27 Foundation specialized __JSONEncoder.wrapGeneric(_:for:) + 4916

28 Foundation JSONEncoder.encode(_:) + 296

The pattern repeats encodeIfPresent → encodeIfPresent multiple times before the overflow. The crash originates from a JSONEncoder.encode() call triggered from the main thread via an Alamofire response callback.

Stack trace (simplified)

Frame 34: TransferFundsVM.validateAndSubmit(data:processId:) (TransferFundsVM.swift:1112)

Frame 35: closure in TransferFundsViewModel.fetchTransfer(type:processId:) (TransferFundsVM.swift:1087)

Frame 28: JSONEncoder.encode(_:) + 296 ← crash here

Frame 0: thread_chkstk_darwin ← stack overflow

ios swift stack-overflow codable jsonencoder

Your Answer

lock_outline

You need to log in to submit an answer.

Newsletter

Subscribe for updates

Advertisement

OffLine
Watch Videos — No Internet
Enjoy trending videos, watch offline anytime. Create, share & stay entertained — even when you’re offline.
  • Watch without internet connection
  • Create & share your videos
  • Fast, smooth & high-quality
Download Now
No signup needed offlinew.com
Terms Privacy Support
© 2025 OffLinew — All rights reserved

Privacy & Cookie Consent

We use cookies to ensure the best experience on our website. This includes analytics, personalization, and marketing purposes. Some cookies are essential for the website to function properly.

By clicking "Accept", you consent to our use of cookies. You can read more about how we use cookies and how you can change your preferences in our Privacy Policy.