- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我想在登录屏幕的登录按钮后面添加一个图像。我目前收到以下错误消息:
由于未捕获的异常“NSInternalInconsistencyException”而终止应用程序,原因:“无法在包中加载 NIB:‘NSBundle <...> 名称 ...
这是我的代码:
在 AppDelegate 中:
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
var authHandle: AuthStateDidChangeListenerHandle?
var userInfo:User!
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
FirebaseApp.configure()
//checkLoggedIn
authHandle = Auth.auth().addStateDidChangeListener { auth, user in
if let user = user {
self.userInfo = user
} else {
// No user is signed in.
self.login()
}
}
return true
}
func login() {
let authUI = FUIAuth.defaultAuthUI()
authUI?.delegate = self as? FUIAuthDelegate
let providers: [FUIAuthProvider] = [
FUIFacebookAuth()
]
authUI?.providers = providers
// Present the auth view controller and then implement the sign in callback.
let authViewController = CustomAuthViewController(authUI: authUI!)
self.window?.rootViewController?.present(authViewController, animated: false, completion: nil)
}
func authPickerViewController(for authUI: FUIAuth) -> FUIAuthPickerViewController {
return CustomAuthViewController(nibName: "CustomAuthViewController",
bundle: Bundle.main,
authUI: authUI)
}
}
在 CustomAuthViewController 中:
class CustomAuthViewController: FUIAuthPickerViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
let width = UIScreen.main.bounds.size.width
let height = UIScreen.main.bounds.size.height
let imageViewBackground = UIImageView(frame: CGRect(x: 0, y: 0, width: width, height: height))
imageViewBackground.image = UIImage(named: "myimage")
// you can change the content mode:
imageViewBackground.contentMode = UIViewContentMode.scaleToFill
view.insertSubview(imageViewBackground, at: 0)
}
你看到哪里不对了吗?我不确定 authPickerViewController 函数应该在我的 AppDelegate 中,你能确认它没问题吗?
我找到了 this发布和this one但我无法让它发挥作用。我使用 Firebase-UI 4.1.1,我的登录流程没有背景图像(因此没有 CustomPickerViewController)。
谢谢,
亚历克斯
最佳答案
这是我的自定义覆盖的样子:
import UIKit
import FirebaseAuthUI
class BizzyAuthViewController: FUIAuthPickerViewController {
override init(nibName: String?, bundle: Bundle?, authUI: FUIAuth) {
super.init(nibName: "FUIAuthPickerViewController", bundle: bundle, authUI: authUI)
}
required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
}
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
let width = UIScreen.main.bounds.size.width
let height = UIScreen.main.bounds.size.height
let imageViewBackground = UIImageView(frame: CGRect(x: 0, y: 0, width: width, height: height))
imageViewBackground.image = UIImage(named: "lavenderWithBees")
// you can change the content mode:
imageViewBackground.contentMode = UIViewContentMode.scaleAspectFill
view.insertSubview(imageViewBackground, at: 0)
}
}
这就是我的登录函数(在“ViewController.swift”中)的样子:
func login() {
//FirebaseApp.configure()
let authUI = FUIAuth.defaultAuthUI()
let providers: [FUIAuthProvider] = [FUIGoogleAuth(), FUIFacebookAuth()]
authUI?.providers = providers
authUI?.delegate = self as FUIAuthDelegate
let authViewController = BizzyAuthViewController(authUI: authUI!)
let navc = UINavigationController(rootViewController: authViewController)
self.present(navc, animated: true, completion: nil)
}
关于ios - FirebaseAuthUI IOS - 如何添加登录屏幕背景图片?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46070531/
所以我正在使用 FirebaseAuthUi,当我收到来自登录进程的请求时,我不断收到此错误: com.firebase.ui.auth.FirebaseUiException:保存凭据时出错。 ..
我想在登录屏幕的登录按钮后面添加一个图像。我目前收到以下错误消息: 由于未捕获的异常“NSInternalInconsistencyException”而终止应用程序,原因:“无法在包中加载 NIB:
我一直在试验新的 iOS FirebaseUI 身份验证 ( https://github.com/firebase/FirebaseUI-iOS/tree/master/FirebaseUI ),并
如何在 swift 3 中正确使用 FirebaseAuthUI 到目前为止我尝试使用这个应用委托(delegate).swift import UIKit import CoreData impor
我是一名优秀的程序员,十分优秀!