iOS SDK V2 Dashboard
Objective-C
Objective-C games (Egret, Cocos Creator) use showProfileWithCallback: to open the SDK profile/account screen:
[[OEGManager sharedManager] showProfileWithCallback:^(OEGActionType type, id response, BOOL success, NSError *error) {
if (type == OEGActionTypeLogout) {
// User tapped Logout inside the SDK screen.
// Navigate back to your game's login screen here.
}
}];
The SDK presents the profile screen modally. The callback fires when the user performs an action (e.g. logout) or dismisses the screen.
Swift — DashboardView
V2 iOS does not expose a showDashboard(from:) convenience method on OEGManager.
The shipped dashboard surface is the SwiftUI DashboardView.
Use DashboardView
import OegSdkV2
import SwiftUI
struct MyGameMenu: View {
var body: some View {
DashboardView(
onLogout: {
OEGAuth.shared.logout()
},
onPayment: {
OEGPayment.shared.purchase(productId: "your_product_id") { result in
print(result)
}
},
onRequestPush: {
OEGPush.shared.requestAuthorization { granted, error in
print("Push granted: \\(granted)")
}
}
)
}
}
Handling logout from the dashboard
When the user taps Logout inside DashboardView:
- The
onLogoutclosure you provided is called - Your closure calls
OEGAuth.shared.logout() logout()clears the session and posts theOEGUserDidLogoutnotification onNotificationCenter
The onLogout closure itself does not navigate the user away from the gameplay screen — your game must observe OEGUserDidLogout and perform the navigation:
// Set this up once at app startup (e.g. in your root coordinator or AppDelegate)
NotificationCenter.default.addObserver(
forName: .OEGUserDidLogout,
object: nil,
queue: .main
) { _ in
// Navigate back to your game's login/main screen
// e.g. dismiss all modals, pop to root, show login view
}
Common bug: Games that only call
OEGAuth.shared.logout()insideonLogoutbut do not observeOEGUserDidLogoutwill clear the SDK session but stay on the gameplay screen — leaving the user stuck.
What the dashboard provides
- Account info
- Profile update
- Change password
- Language selection
- Payment test hook
- Push permission test hook
- Logout
When to use it
Use DashboardView if:
- Your app already uses SwiftUI
- You want a ready-made SDK account/settings screen
Skip it if:
- You are building a custom UIKit/SwiftUI account surface on top of
OEGAuth