Firebase无法在真实设备上使用(iOS) [英] Firebase not worked on real devices (iOS)

查看:219
本文介绍了Firebase无法在真实设备上使用(iOS)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的iOS应用程序中安装Firebase。
一切工作正常在模拟器上,但在真实的设备上,它不执行/返回查询到我的数据库。

我尝试清理项目,但不会改变任何内容。



您有解决方法吗?

编辑:用代码更新

 重写func viewDidLoad(){
super.viewDidLoad()

//设置Firebase
self.ref = FIRDatabase数据库中的observeEventType(.Value,withBlock:{(snapshot))$ b $($)$。


$ b self.ref.child b

如果snapshot.exists(){
在snapshot.children.allObjects中休息为![FIRDataSnapshot] {
print(rest.value)


$ b $ else b


$ b}){(error)in
print(error。 localizedDescription)



$解析方案

你的代码没有错,我有同样的问题。以下是我所做的:

$ ol

  • 只需在左侧的导航窗格中转到您的项目。


  • 转到生成设置,然后向下滚动到生成选项

  • 启用位码的值更改为

    希望它也适合你!


    I install Firebase in my iOS app. Everything works fine on simulator but on real device it doesn't execute / return a query to my database.

    I try to clean the project but it doesn't change anything.

    Have you a solution ?

    EDIT : Update with code

    override func viewDidLoad() {
        super.viewDidLoad()
    
        // Setup Firebase
        self.ref = FIRDatabase.database().reference()
    
    
    
        self.ref.child("Database").observeEventType(.Value, withBlock: { (snapshot) in
    
    
            if snapshot.exists() {
                for rest in snapshot.children.allObjects as! [FIRDataSnapshot] {
                    print(rest.value)
    
    
                }
            } else {
    
    
            }
    
        }) { (error) in
            print(error.localizedDescription)
        }
    }
    

    解决方案

    There is no fault in your code, I had the same problem. Here is what I did:

    1. Simply go to Your Project in the navigation pane on the left.

    2. Go to Build Settings and scroll down to Build Options.

    3. Change the value of Enable Bitcode to No.

    Hope it works out for you too!

    这篇关于Firebase无法在真实设备上使用(iOS)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

  • 查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆