2016-07-28 11 views
0

Um ein Projekt Problem auszuschließen, habe ich eine brandneue Single Ansicht Projekt und addierten die folgenden podfile:Firebase 3: Unklare Verwendung von ‚observeEventType (_: withBlock :)‘

target 'App' do 
    use_frameworks! 

    pod 'Firebase' 
    pod 'Firebase/Auth' 
    pod 'Firebase/Database' 
end 

ich die dann hinzugefügt folgender Code:

import UIKit 
import FirebaseDatabase 

class ViewController: UIViewController { 

    let ref = FIRDatabase.database().reference() 

    override func viewDidAppear(animated: Bool) { 
     super.viewDidAppear(animated) 

     ref.observeEventType(.Value) { (snapshot) in 

     } 
    } 
} 

das Ergebnis ist der folgende Fehler:

Ambiguous use of 'observeEventType(_:withBlock:)'

mit:

Found this candidate (FirebaseDatabase.FIRDatabaseReference)

Found this candidate (FirebaseDatabase.FIRDatabaseReference)

Ich verwende Xcode 7.3.1 und die podfile.lock ist wie folgt:

PODS: 
    - Firebase (3.3.0): 
    - Firebase/Core (= 3.3.0) 
    - Firebase/Analytics (3.3.0): 
    - FirebaseAnalytics (= 3.2.1) 
    - Firebase/Core (3.3.0): 
    - Firebase/Analytics (= 3.3.0) 
    - Firebase/Database (3.3.0): 
    - Firebase/Analytics (= 3.3.0) 
    - FirebaseDatabase (= 3.0.2) 
    - FirebaseAnalytics (3.2.1): 
    - FirebaseInstanceID (~> 1.0) 
    - GoogleInterchangeUtilities (~> 1.2) 
    - GoogleSymbolUtilities (~> 1.1) 
    - GoogleUtilities (~> 1.3) 
    - FirebaseDatabase (3.0.2): 
    - FirebaseAnalytics (~> 3.2) 
    - FirebaseInstanceID (1.0.7) 
    - GoogleInterchangeUtilities (1.2.1): 
    - GoogleSymbolUtilities (~> 1.0) 
    - GoogleSymbolUtilities (1.1.1) 
    - GoogleUtilities (1.3.1): 
    - GoogleSymbolUtilities (~> 1.0) 

DEPENDENCIES: 
    - Firebase 
    - Firebase/Database 

SPEC CHECKSUMS: 
    Firebase: 6250071f0e2440a5c4c67b8cb6b868f868237ac3 
    FirebaseAnalytics: 0fd6532cb2c3d03cd5cf26ad295ccb091efd3104 
    FirebaseDatabase: 59bea2e7dfd81b3b8b2f8e396caf1a52c2ced6f7 
    FirebaseInstanceID: a9d923f3d0b6fbf9fac89310860357aaadc34be5 
    GoogleInterchangeUtilities: def8415a862effc67d549d5b5b0b9c7a2f97d4de 
    GoogleSymbolUtilities: 33117db1b5f290c6fbf259585e4885b4c84b98d7 
    GoogleUtilities: 56c5ac05b7aa5dc417a1bb85221a9516e04d7032 

PODFILE CHECKSUM: 261a8ee435b8325808d7a0962ace0c908fd37368 

COCOAPODS: 1.0.1 

gleiche Problem mit observeSingleEventOfType(_:withBlock:)

Antwort

7

Es scheint, wie es ein Swift bug ist, versuchen Sie diese Syntax verwenden statt (ohne Verschluss Syntax Hinter.):

ref.observeEventType(.Value, withBlock: { firDataSnapshot in 

}) 

Weitere Informationen: Ambiguous use of 'observeSingleEventOfType(_:withBlock:)' error in Swift

+0

Ja, das hat es gelöst! Seltsames ... Als ich eine Druckanweisung einwarf, kompilierte es ok, aber jeder andere Code in der Schließung würde den Fehler werfen ... Danke! – doovers

+0

@doovers Ich war dort: / – iOSGeek

Verwandte Themen