diff --git a/app/src/app_ios.mm b/app/src/app_ios.mm index 36a2382fe3..653c0c2043 100644 --- a/app/src/app_ios.mm +++ b/app/src/app_ios.mm @@ -30,6 +30,40 @@ #include "app/src/util.h" #include "app/src/util_ios.h" +#include +#include +#include + +// Workaround for Xcode 15+ / Swift 5.10+ Concurrency and C++ verbose abort +// crash on older iOS versions (iOS 15/16). +// By providing this symbol in our own binary, we prevent dyld from +// crashing when it is missing from the system libc++ on older OSs. +#if defined(_LIBCPP_VERBOSE_ABORT_NOEXCEPT) +#define FIREBASE_LIBCPP_VERBOSE_ABORT_NOEXCEPT _LIBCPP_VERBOSE_ABORT_NOEXCEPT +#elif defined(__apple_build_version__) && __apple_build_version__ >= 16000000 && \ + __apple_build_version__ < 20000000 +#define FIREBASE_LIBCPP_VERBOSE_ABORT_NOEXCEPT +#else +#define FIREBASE_LIBCPP_VERBOSE_ABORT_NOEXCEPT noexcept +#endif + +#ifndef _LIBCPP_ABI_NAMESPACE +#define _LIBCPP_ABI_NAMESPACE __1 +#endif + +namespace std { +inline namespace _LIBCPP_ABI_NAMESPACE { +__attribute__((weak)) void __libcpp_verbose_abort(const char* format, + ...) FIREBASE_LIBCPP_VERBOSE_ABORT_NOEXCEPT { + std::va_list list; + va_start(list, format); + std::vfprintf(stderr, format, list); + va_end(list); + std::abort(); +} +} // namespace _LIBCPP_ABI_NAMESPACE +} // namespace std + #include "FIROptions.h" @interface FIRApp () diff --git a/release_build_files/readme.md b/release_build_files/readme.md index 62cfb27116..8846a4b9d8 100644 --- a/release_build_files/readme.md +++ b/release_build_files/readme.md @@ -613,6 +613,10 @@ workflow use only during the development of your app, not for publicly shipping code. ## Release Notes +### Upcoming +- Changes + - General (iOS): Fixed a startup crash on iOS 15 and 16 due to a missing `__libcpp_verbose_abort` symbol. + ### 13.9.0 - Changes - General (Android): Update to Firebase Android BoM version 34.15.0. diff --git a/testing/sample_framework/src/app_framework.cc b/testing/sample_framework/src/app_framework.cc index 96c0a6b21c..892eb917e0 100644 --- a/testing/sample_framework/src/app_framework.cc +++ b/testing/sample_framework/src/app_framework.cc @@ -26,38 +26,6 @@ #include #include -#if defined(__APPLE__) -#include -// Workaround for Xcode 15 / Swift 5.10 Concurrency and C++ verbose abort -// crash on older iOS versions (iOS 15/16). -// By providing these symbols in our own binary, we prevent dyld from -// crashing when they are missing from the system libraries on older OSs. - -// In Xcode 16, libc++ removed the noexcept specifier from -// __libcpp_verbose_abort. -#if defined(_LIBCPP_VERBOSE_ABORT_NOEXCEPT) -#define FIREBASE_LIBCPP_VERBOSE_ABORT_NOEXCEPT _LIBCPP_VERBOSE_ABORT_NOEXCEPT -#elif defined(__apple_build_version__) && \ - __apple_build_version__ >= 16000000 && __apple_build_version__ < 20000000 -#define FIREBASE_LIBCPP_VERBOSE_ABORT_NOEXCEPT -#else -#define FIREBASE_LIBCPP_VERBOSE_ABORT_NOEXCEPT noexcept -#endif - -namespace std { -inline namespace __1 { -__attribute__((weak)) void __libcpp_verbose_abort(const char* format, ...) - FIREBASE_LIBCPP_VERBOSE_ABORT_NOEXCEPT { - va_list list; - va_start(list, format); - vfprintf(stderr, format, list); - va_end(list); - abort(); -} -} // namespace __1 -} // namespace std -#endif - namespace app_framework { // Base logging methods, implemented by platform-specific files.