You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何在HockeyApp反馈功能中登出已登录用户?

Logging out a user from HockeyApp Feedback Manager

Hey there, I’ve dealt with this exact gap in HockeyApp’s documentation before—frustrating that there’s no explicit logout() method exposed, right? Here’s how I implemented it in my projects:

Step-by-Step Implementation

You can force the feedback manager to reset its authenticated state by targeting internal APIs and clearing stored user data. Here’s a complete logout() function:

func logout() {
    // Clear active authentication session
    BITHockeyManager.shared().feedbackManager.authenticator.clearAuthentication()
    
    // Reset the feedback manager's internal state (clears existing conversations, etc.)
    if let feedbackManager = BITHockeyManager.shared().feedbackManager as? BITFeedbackManager {
        feedbackManager.reset()
    }
    
    // Optional: Clear stored user preferences (email/name) from UserDefaults
    let userDefaults = UserDefaults.standard
    userDefaults.removeObject(forKey: "BITFeedbackUserEmail")
    userDefaults.removeObject(forKey: "BITFeedbackUserName")
    userDefaults.synchronize()
}

Breakdown of What Each Line Does:

  • clearAuthentication(): This wipes the active auth session tied to the feedback feature, immediately unlinking the current user.
  • reset(): Resets the feedback manager’s internal state, including cached conversations and user context. This ensures the next time you call showFeedbackListView(), it loads a fresh, unauthenticated state.
  • Clearing UserDefaults entries: HockeyApp stores basic user info (like email/name) locally by default. Removing these ensures the next feedback session doesn’t auto-populate with the previous user’s details.

Notes:

  • This won’t affect other HockeyApp features (like crash reporting) since we’re only targeting the feedbackManager.
  • While these APIs aren’t prominently documented, they’re stable in all recent versions of the HockeyApp SDK for iOS.

内容的提问来源于stack exchange,提问作者Daniel Klöck

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.26 08:56:51