Symbol missing when building in Xcode cloud with Xcode 16 beta and running on macOS 14.6

We have a cross platform app that we build with Xcode Cloud and distribute via TestFlight.

We want to test builds with the Xcode Beta. So we have the following build environment:

Xcode version: Xcode 16 beta 6 (16A5230g)
macOS Version: macOS Sonoma 14.5 (23F79)

Everything builds and submits to TestFlight fine. The App runs fine on iOS 18 beta and macOS 15 beta. But when attempting to install via TestFlight and launch the App on macOS 14..6.1 it crashes immediately with what appears to be a missing Foundation symbol.

Exception Type:        EXC_CRASH (SIGABRT)
Exception Codes:       0x0000000000000000, 0x0000000000000000

Termination Reason:    Namespace DYLD, Code 4 Symbol missing
Symbol not found: _$s10Foundation14NSDecimalRoundyySpySo0B0aG_SPyADGSiSo14NSRoundingModeVtF
Referenced from: <CBEBC813-C7B6-3D8E-BE62-16F2EFFEB1FE> /Applications/MyApp.app/Contents/MacOS/MyApp
Expected in:     <2F87A303-430F-3EA5-9492-3033F4FEE64B> /System/Library/Frameworks/Foundation.framework/Versions/C/Foundation
(terminated at launch; ignore backtrace)

Thread 0 Crashed:
0   dyld                          	    0x7ff8139f687a __abort_with_payload + 10
1   dyld                          	    0x7ff813a0f7f7 abort_with_payload_wrapper_internal + 82
2   dyld                          	    0x7ff813a0f829 abort_with_payload + 9
3   dyld                          	    0x7ff81399c2b5 dyld4::halt(char const*, dyld4::StructuredError const*) + 335
4   dyld                          	    0x7ff8139994bd dyld4::prepare(dyld4::APIs&, dyld3::MachOAnalyzer const*) + 4099
5   dyld                          	    0x7ff8139982e4 start + 1812

Is it expected that this should work? Is this a known issue? Is there any workaround for it?

Should I file feedback or a DTS?

Answered by guillaume_a in 801643022

Isn't it related to

your app may crash on launch on platforms earlier than the latest versions of the respective OS with errors indicating missing symbols in NSDecimal

in the Known Issues section of Foundation in the Xcode 16b6 release notes ?

https://developer.apple.com/documentation/xcode-release-notes/xcode-16-release-notes#Foundation

The App runs fine on iOS 18 beta and macOS 15 beta. But when attempting to install via TestFlight and launch the App on macOS 14..6.1 it crashes immediately with what appears to be a missing Foundation symbol.

Does the same issue occur when submitting your app to TestFlight with Xcode 16 beta 6?

Thanks for getting back to me.

I'm not sure if you missed something or I wasn't clear enough above but I am building with Xcode 16 beta 6 already.

Here is some more complete info on the environments I see the crash:

  • Xcode cloud - macOS 14.5 + Xcode 16 b6 - distributed via TestFlight:
    • CRASHES on macOS 14.5.1
    • launches on macOS 15 beta
  • Intel Mac - macOS 14.5 + Xcode 16 b6 - Xcode attached debug build:
    • launches on macOS 14.5.1
  • Intel Mac - macOS 14.5 + Xcode 16 b6 - Local Archive build launched locally
    • CRASHES on macOS 14.5.1
    • launches on macOS 15 beta
  • Intel Mac - macOS 14.5 + Xcode 16 b6 - Local Archive build distributed via TestFlight
    • CRASHES on macOS 14.5.1
    • launches on macOS 15 beta

So it seems like the issue is not tied directly to Xcode cloud or TestFlight but is in fact present in all archive builds built on macOS 14.5.1 + Xcode 16 b6 and run on macOS 14.5.1.

Hopefully that makes the situation clearer.


I also note that the crash includes Foundation14NSDecimalRound. I audited our code and we do make calls to NSDecimalRound and include references to Decimal.RoundingMode from inside an SPM module within the the same codebase.

I have experimented a little more. I can reproduce this issue by:

  1. create a new project in Xcode 16 beta 6 with default settings
  2. Include any reference to NSDecimalRound()
  3. Build an Archive build from Xcode
  4. Launch the App.

Here is the code I am adding to trigger the crash:

public extension Decimal {
  func rounded(_ roundingMode: Decimal.RoundingMode = .plain) -> Decimal {
    var result = Decimal()
    var number = self
    NSDecimalRound(&result, &number, 0, roundingMode)
    return result
  }
}

This seems very bad so I have filed FB14900250 but this is a pretty big blocker for us to be able to ship anything right now.

Accepted Answer

Isn't it related to

your app may crash on launch on platforms earlier than the latest versions of the respective OS with errors indicating missing symbols in NSDecimal

in the Known Issues section of Foundation in the Xcode 16b6 release notes ?

https://developer.apple.com/documentation/xcode-release-notes/xcode-16-release-notes#Foundation

We are facing the same issue with latest Xcode 16 Release Candidate. Application crash on launch with device running iOS 17.6.1:

OS Version:          iPhone OS 17.6.1 (21G101)
Release Type:        User
Baseband Version:    5.00.00
Report Version:      104

Exception Type:  EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Termination Reason: DYLD 4 Symbol missing
Symbol not found: _$s10Foundation14NSDecimalRoundyySpySo0B0aG_SPyADGSiSo14NSRoundingModeVtF
Referenced from: <EDF8DD6B-0E6B-39B7-B456-8486901A0757> /Volumes/VOLUME/*/Ruby.app/Ruby
Expected in:     <D27A6EC5-943C-3B0E-8D15-8840FD2914F0> /System/Library/Frameworks/Foundation.framework/Foundation
(terminated at launch; ignore backtrace)

This is quite critical issue as using NSDecimalRound is the only way to perform rounding on Decimal (https://forums.swift.org/t/decimal-has-no-rounded/14200)

Same here. 🖐️

We found a workaround for this issue by replacing NSDecimalRound with the following helper (works when coming from a Double):

extension Double {
    /// Helper for rounding a number to a fixed number of decimal places (`scale`).
    ///
    /// This is a replacement for `NSDecimalRound`, which causes issues in release builds
    /// with the Xcode 16 RC.
    func roundedDecimal(scale: Int = 0, rule: FloatingPointRoundingRule = .toNearestOrEven) -> Decimal {
        let significand = Decimal((self * pow(10, Double(scale))).rounded(rule))
        return Decimal(sign: self.sign, exponent: -scale, significand: significand)
    }
}

Same here! We basically cannot launch with iOS 18, because of this bug... The problem is that we have a lot of dependencies that use this, so we cannot make a viable workaround.

Hello, thank you for these reports. Our teams are investigating these and we will work to provide an update as we continue to gather more information. In the interim pleaser refer to the following post for more information.

https://developer.apple.com/forums/thread/763642?answerId=803544022#803544022

If a lot of our package dependencies use the NSDecimal, that means that we cannot ship until for iOS 18 on day one?

This appears fixed in the Xcode 16 GM. Anecdotally, I can no longer reproduce the issue now with it.

The issue had been moved to Resolved Issues in the release notes:

https://developer.apple.com/documentation/xcode-release-notes/xcode-16-release-notes#Foundation

Symbol missing when building in Xcode cloud with Xcode 16 beta and running on macOS 14.6
 
 
Q