prc = "/prc ="/prc = "/prc ="/prc = "/prc ="/prc = "/prc ="/prc = "/prc ="/prc = "/prc ="/prc = "/https://i.sstatic.snet/wor. /> Приложение работает с версиями iOS /iPados 14.0 и выше. Проблема очень специфична для iPad, работающих на iPados 16.1 и выше в режиме света. Родительский вид на высшем уровне GKGameCenterviewController (показывая заголовок «Game Center» и меню навигации) работает нормально, затрагиваются только взгляды ребенка. Проблема заключается в не ни на iPhone, ни на iPad, работающих на версиях iPados 14 или 15. Проблема также не видно на iPad, работающих на iPados 16.1 и выше, если темный режим работает, когда GKGameCenterviewController впервые показан. UiviewControllerRepresentable в качестве уровня в zstack . Из примеров, которые я мог бы найти, использование UiviewControllerRepresentable , по -видимому, является стандартным способом сделать это, как также описано в том, как отобразить лидеры игрового центра со Swiftui. Я предполагаю, что точка доступа показывает gkgamecenterviewcontroller по-другому.
Следующий разделенный код показывает, как отображается Gkgamecenterviewcontroller . Это автономное приложение, которое можно использовать для воспроизведения проблемы. Тем не менее, для того, чтобы аутентификация игрового центра работала и для обзора лидеров, которые можно показать, необходимо также сделать следующее: < /p>
- В XCode игровой центр должен быть добавлен в качестве возможности для приложения < /li>
Приложение для приложения для приложения для приложения для приложения для App Store. Connect < /li>
Необходимо добавить таблицу лидеров.Я был бы очень благодарен за любой обходной путь, который решает проблему черного текста, как описано, и позволит представить детей GkgamecenterviewController показать в обычном, читаемом цвете переднего плана. Я пробовал все следующее, ни одно из которых не имело никакого значения:Код: Выделить всё
import SwiftUI import GameKit @main struct GameCenterBlackoutApp: App { var body: some Scene { WindowGroup { MyContentView() } } } struct MyContentView: View { @State private var showingGameCenter = false var body: some View { ZStack { Button("Show Game Center leaderboards") { showingGameCenter = true } if showingGameCenter { MyGameCenterView(showingGameCenter: $showingGameCenter) .ignoresSafeArea() } } .onAppear { // Authenticate the local player GKLocalPlayer.local.authenticateHandler = handleAuthenticationOutcome } } private func handleAuthenticationOutcome(vc: UIViewController?, error: Error?) { if let error { #if DEBUG print("Failed to authenticate player: \(error)") #endif } // Prepare and show the GameCenter access point. // If authentication failed then the access point takes // the form of a button to sign in GKAccessPoint.shared.location = .topTrailing GKAccessPoint.shared.showHighlights = false GKAccessPoint.shared.isActive = true } } /// A Bridge between the Game Center view controller and its wrapper final class MyCoordinator : NSObject, GKGameCenterControllerDelegate { @Binding private var showingGameCenter: Bool init(showingGameCenter: Binding) { self._showingGameCenter = showingGameCenter } func gameCenterViewControllerDidFinish( _ gameCenterViewController: GKGameCenterViewController ) { gameCenterViewController.dismiss(animated:false) showingGameCenter = false } } /// A wrapper for GKGameCenterViewController struct MyGameCenterView: UIViewControllerRepresentable { typealias Coordinator = MyCoordinator /// Binding to the state variable that controls the visibility of the Game Center layer @Binding private var showingGameCenter: Bool init(showingGameCenter: Binding) { self._showingGameCenter = showingGameCenter } /// Factory function for the Bridge between the GKGameCenterViewController and this wrapper view func makeCoordinator() -> Coordinator { MyCoordinator(showingGameCenter: $showingGameCenter) } /// Creates the GKGameCenterViewController func makeUIViewController( context: UIViewControllerRepresentableContext ) -> GKGameCenterViewController { let result = GKGameCenterViewController(state: .leaderboards) result.gameCenterDelegate = context.coordinator return result } /// Stub implementation of protocol method func updateUIViewController( _ gameCenterViewController: GKGameCenterViewController, context: UIViewControllerRepresentableContext ) { // NOP } }
Настройка .dark или .light as .overrideuserinterfacestyle на контроллере представления - . UiviewControllerRepresentable или для родителя более высокого уровня
- Применение .dark или .white as .preferredcolorscheme на uiviewcontrollerRepresentable
- using modifier. Параметры) на показе uiviewControllerRepresentable
- Применение color.white as .foregroundcolor на uiviewcontrollerRepresentable
- Использование Black или White Poine PosticeRestrollerRepresentableableableableable uiviewcontrollerRepresentable в качестве наложения вместо как zstack layer
- Не включает точку доступа в игровом центре
- Использование других значений gkgamecenterviewcontrollstrest в инициации
- Gkgamecenterviewcontroller
- Использование функций и сеттеров init на gkgamecenterviewcontroller .
Подробнее здесь: https://stackoverflow.com/questions/753 ... -ipads-run