gpt4 book ai didi

swift - iOS 版 Cannonball 中如何调用登录屏幕?

转载 作者:行者123 更新时间:2023-11-30 14:12:21 25 4
gpt4 key购买 nike

我是 iOS 版 Digits 新手。我已经使身份验证部分正常工作,现在我正在尝试将登录与我的应用程序的其余部分集成。

真正让我困惑的一件事是,在 Cannonball 中,初始 View Controller 是主屏幕。但是,运行 Cannonball 时,我看到的第一个屏幕是“登录”屏幕。

我没有看到从导航 Controller 到登录的任何连接。另外,我查看了主题选择器 View Controller 中的代码,没有看到任何对登录 View Controller 的引用。

那么,登录屏幕实际上是如何执行的?这个逻辑发生在哪里?谢谢。

enter image description here

最佳答案

答案是 AppDelegate.swift 文件执行逻辑。下面的代码是从 Cannonball 复制/粘贴的。我继续添加评论(有些评论是与 Cannonball 一起提供的)。

func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject : AnyObject]?) -> Bool {
// Developers: Welcome! Get started with Fabric.app.
let welcome = "Welcome to Cannonball! Please onboard with the Fabric Mac app. Check the instructions in the README file."
assert(NSBundle.mainBundle().objectForInfoDictionaryKey("Fabric") != nil, welcome)

// Register Crashlytics, Twitter, Digits and MoPub with Fabric.
//Fabric.with([Crashlytics(), Twitter(), Digits(), MoPub()])
Fabric.with([Digits()])

// Check for an existing Twitter or Digits session before presenting the sign in screen.
// Detect if the Digits session is nil
// if true, set the root view controller to the Sign In's view controller
if Twitter.sharedInstance().session() == nil && Digits.sharedInstance().session() == nil {
//Main corresponds to Main.storyboard
let storyboard = UIStoryboard(name: "Main", bundle: nil)
//Sign In's View Controller
let signInViewController: AnyObject! = storyboard.instantiateViewControllerWithIdentifier("SignInViewController")
//Set the UIWindow's ViewController to the SignIn's ViewController
window?.rootViewController = signInViewController as? UIViewController
}
return true
}

关于swift - iOS 版 Cannonball 中如何调用登录屏幕?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31633603/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com