Disable NSUserDefaults initialization workaround on iOS
Core Foundation would fail to pick up defaults from command line arguments, as the logic to read the command line arguments was in the Foundation class NSUserDefaults. As a workaround, we initialized NSUserDefaults as early as we could, so that we could use Core Foundation elsewhere in Qt. As NSUserDefaults is considered a potential privacy risk, and needs explicit declaration of use for iOS in the privacy manifest, we disable the workaround for iOS. This should be okey, as the original issue does not seem to manifest on iOS 17, and was only a problem in practice when using command line arguments to debug things. The issue is also seemingly gone from macOS 14.3, but we keep the workaround in for now, just in case. Task-number: QTBUG-114319 Change-Id: I2c698353673f797756a877a49cfbd8a37367c31e Reviewed-by: Doris Verria <doris.verria@qt.io> (cherry picked from commit 6657acf8f57529bfe601d18db5d594773f51fe91) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
776b987638
commit
97b7fea4c3
@ -52,6 +52,7 @@ QT_BEGIN_NAMESPACE
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
#if defined(Q_OS_MACOS)
|
||||
static void initializeStandardUserDefaults()
|
||||
{
|
||||
// The standard user defaults are initialized from an ordered list of domains,
|
||||
@ -64,6 +65,7 @@ static void initializeStandardUserDefaults()
|
||||
Q_UNUSED(NSUserDefaults.standardUserDefaults);
|
||||
}
|
||||
Q_CONSTRUCTOR_FUNCTION(initializeStandardUserDefaults);
|
||||
#endif
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
|
@ -32,9 +32,11 @@ static void printLocalizationInformation()
|
||||
if (!lcLocale().isDebugEnabled())
|
||||
return;
|
||||
|
||||
#if defined(Q_OS_MACOS)
|
||||
// Trigger initialization of standard user defaults, so that Foundation picks
|
||||
// up -AppleLanguages and -AppleLocale passed on the command line.
|
||||
Q_UNUSED(NSUserDefaults.standardUserDefaults);
|
||||
#endif
|
||||
|
||||
auto singleLineDescription = [](NSArray *array) {
|
||||
NSString *str = [array description];
|
||||
|
Loading…
x
Reference in New Issue
Block a user