Does this program crash on a device using iOS 26?

I have created a small program to show an issue with std::locale. This small program works fine on some simulators but crashes on devices running iOS 27. I do not have anymore access to a device running iOS 26. Can anybody please check the result for me?

I believe that this program did not crash on IOS 18 but I am not sure. It should be stored as main.mm because it uses ObjectiveC++.

It does not do anything but calling std::locale, respectively std::locale::global.

Thank you for your help!

#include <locale>

#import <UIKit/UIKit.h>

@interface AppDelegate : UIResponder <UIApplicationDelegate>

@end

@implementation AppDelegate

  • (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

    std::locale::global(std::locale("de_DE.UTF-8"));
    std::locale::global(std::locale("fr_FR.UTF-8"));
    return YES;
    }

#pragma mark - UISceneSession lifecycle

  • (UISceneConfiguration *)application:(UIApplication *)application configurationForConnectingSceneSession:(UISceneSession *)connectingSceneSession options:(UISceneConnectionOptions *)options {
    // Called when a new scene session is being created.
    // Use this method to select a configuration to create the new scene with.
    return [[UISceneConfiguration alloc] initWithName:@"Default Configuration" sessionRole:connectingSceneSession.role];
    }

  • (void)application:(UIApplication *)application didDiscardSceneSessions:(NSSet<UISceneSession *> *)sceneSessions {
    // Called when the user discards a scene session.
    // If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions.
    // Use this method to release any resources that were specific to the discarded scenes, as they will not return.
    }

@end

@interface SceneDelegate : UIResponder <UIWindowSceneDelegate>

@end

@implementation SceneDelegate

-(void)scene:(UIScene *)scene willConnectToSession:(UISceneSession *)session options:(UISceneConnectionOptions *)connectionOptions
{
}

  • (void)sceneDidDisconnect:(UIScene *)scene {
    // Called as the scene is being released by the system.
    // This occurs shortly after the scene enters the background, or when its session is discarded.
    // Release any resources associated with this scene that can be re-created the next time the scene connects.
    // The scene may re-connect later, as its session was not necessarily discarded (see application:didDiscardSceneSessions instead).
    }

  • (void)sceneDidBecomeActive:(UIScene *)scene {
    // Called when the scene has moved from an inactive state to an active state.
    // Use this method to restart any tasks that were paused (or not yet started) when the scene was inactive.
    }

  • (void)sceneWillResignActive:(UIScene *)scene {
    // Called when the scene will move from an active state to an inactive state.
    // This may occur due to temporary interruptions (ex. an incoming phone call).
    }

  • (void)sceneWillEnterForeground:(UIScene *)scene {
    // Called as the scene transitions from the background to the foreground.
    // Use this method to undo the changes made on entering the background.
    }

  • (void)sceneDidEnterBackground:(UIScene *)scene {
    // Called as the scene transitions from the foreground to the background.
    // Use this method to save data, release shared resources, and store enough scene-specific state information
    // to restore the scene back to its current state.
    }

@end

int main(int argc, char * argv[])
{
NSString * appDelegateClassName;
@autoreleasepool
{
// Setup code that might create autoreleased objects goes here.
appDelegateClassName = NSStringFromClass([AppDelegate class]);
}
return UIApplicationMain(argc, argv, NSStringFromClass([UIApplication class]), appDelegateClassName);
}

Answered by DTS Engineer in 920371022

Here’s what I did:

  1. In Xcode 27.2, I chose Project > New.

  2. I selected Choose Template, and then chose the iOS > App template.

  3. In the project configuration, I selected Storyboard for the UI and Objective-C for the language.

  4. In the resulting project, I renamed AppDelegate.m to AppDelegate.mm.

  5. I added this to the list of imports:

    #include <locale>
    
  6. And this to -application:didFinishLaunchingWithOptions::

    std::locale::global(std::locale("de_DE.UTF-8"));
    std::locale::global(std::locale("fr_FR.UTF-8"));
    
  7. I changed the deployment target to iOS 26.

  8. And ran the app on an iOS 26.7.3 device.

The app crashed on launch with the message:

libc++abi: terminating due to uncaught exception of type std::runtime_error: collate_byname<char>::collate_byname failed to construct for de_DE.UTF-8

pointing at the first line of code that I added.

Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Accepted Answer

Here’s what I did:

  1. In Xcode 27.2, I chose Project > New.

  2. I selected Choose Template, and then chose the iOS > App template.

  3. In the project configuration, I selected Storyboard for the UI and Objective-C for the language.

  4. In the resulting project, I renamed AppDelegate.m to AppDelegate.mm.

  5. I added this to the list of imports:

    #include <locale>
    
  6. And this to -application:didFinishLaunchingWithOptions::

    std::locale::global(std::locale("de_DE.UTF-8"));
    std::locale::global(std::locale("fr_FR.UTF-8"));
    
  7. I changed the deployment target to iOS 26.

  8. And ran the app on an iOS 26.7.3 device.

The app crashed on launch with the message:

libc++abi: terminating due to uncaught exception of type std::runtime_error: collate_byname<char>::collate_byname failed to construct for de_DE.UTF-8

pointing at the first line of code that I added.

Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Hi,

thanks for testing. This essentially means that <locale> is not supported by iOS.

Pretty bad 👎