2

I am trying to configure a swift app with two firebase db. See related stack overflow link

Use more than one Firebase database in single app - Swift

when my app gets to the line below it crashes with an error of 'App name should only contain Letters, Numbers and Underscore.'

    FIRApp.configureWithName("Swift Scanner", options: firOptions)

The project name in firebase is Swift Scanner, and the project ID in firebase is swift-scanner. I have tried these names in the above line but with no success.

I have also tried using the Xcode project name, swiftScanner, as well but I get the following error

'Terminating app due to uncaught exception 'com.firebase.instanceid', reason: 'Could not configure Firebase InstanceID.'

Update: I passed in nil for the storageBucket and the GMSenderID. After I passed in the right values I no longer get the above errors. I know get a nil value error when I try to read the second database. See code below

 FIRApp.configureWithName("swiftScanner", options: firOptions)
 let app = FIRApp(named:"swiftScanner")


let rootRef = FIRDatabase.database(app: app!)

    var refHandle = rootRef.reference().observeEventType(FIRDataEventType.Value,
    withBlock: { (snapshot) in



        if let object = snapshot.value as? String{
            print(object)
        }


    })

I will update again if I manage to figure this out.

Community
  • 1
  • 1
ray
  • 903
  • 1
  • 13
  • 31

0 Answers0