Tag: 火力

在加载数据之前完成所有asynchronous请求?

我遇到了一个问题,我有多个asynchronous请求,从Facebook API和我的Firebase数据库抓取图像和信息。 我想执行所有的asynchronous请求,然后将从Facebook API / Firebase数据库中获取的所有数据存储到一个可以快速加载的完整对象中。 我已经为每个asynchronous请求设置了完成处理程序,我认为强制程序在请求完成之前“等待”,然后让程序继续运行,但这似乎不适用于我。 以下是我的尝试: func setupEvents(completion: (result: Bool, Event: Event) -> Void){ // Get a reference to Events eventsReference = Firebase(url:"<DB Name>") eventAttendeesRef = Firebase(url:"<DB Name>") //Read the data at our posts reference println("Event References: \(eventsReference)") eventsReference.observeEventType(FEventType.ChildAdded, withBlock: { (snapshot) -> Void in let eventName = snapshot.value["eventName"] as? String let eventLocation […]

Firebase收到推送通知时未收到popup窗口

import Firebase import FirebaseInstanceID import FirebaseMessaging func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { registerForPushNotifications(application) FIRApp.configure() // Add observer for InstanceID token refresh callback. NSNotificationCenter .defaultCenter() .addObserver(self, selector: #selector(AppDelegate.tokenRefreshNotificaiton), name: kFIRInstanceIDTokenRefreshNotification, object: nil) // Override point for customization after application launch. return true } func registerForPushNotifications(application: UIApplication) { let settings: UIUserNotificationSettings = UIUserNotificationSettings(forTypes: […]

导入Firebase后,Xcode 8.0testing版会发出错误提示

我使用Xcode 8.0 beta 5或6创build空的swift项目,并使用类似Firebase指南的cocoapods导入Firebase。 在import过程中,一切都很好。 我使用FIRApp.Configure()注释来configurationFIRApp.Configure() 。 我可以处理身份validation,但是当我试图达到数据库它不起作用。 在FIRApp.h构build时间错误, FIRApp.h所示: "Conflicting nullability specifier on return types, 'nullable' conflicts with existing specifier 'non null'" FIRApp.h生成时错误的屏幕截图 在控制台中也是这样的错误: 2016-08-26 13:00:32.719: <FIRInstanceID/WARNING> STOP!! Will reset deviceID from memory. 2016-08-26 13:00:32.719: <FIRInstanceID/WARNING> Failed to fetch default token Error Domain=com.firebase.iid Code=6 "(null)" 2016-08-26 13:02:08.329: <FIRInstanceID/WARNING> Failed to retrieve the default GCM […]

iOS Swift:无法将值types“__NSCFNumber”转换为“NSString”

我从我的Firebase数据库(JSON数据库)中检索数字值,然后将此数字显示到textField ,但是当我尝试显示该数字时出现此错误。 无法将值types“__NSCFNumber”转换为“NSString” 我怎样才能正确地将检索到的值转换为一个string,考虑到这个值可能会改变之间的string和数字,当我检索它。 这是我的代码: let quantity = child.childSnapshot(forPath: "quantity").value // Get value from Firebase // Check if the quantity exists, then add to object as string. if (!(quantity is NSNull) && ((quantity as! String) != "")) { newDetail.setQuantity(quantity: quantity as! String) }

多个GoogleService-Info支持

我将我的Dev和Prod计划注册为Firebase中的不同应用程序。 我希望他们是分开的,每个都有唯一的包ID。 我正在使用#if dev来确定它是否是dev或prodscheme。 我怎样才能为这个计划初始化一个专门的plist的firebase?

无法调用非functiontypes模块的值<Firebase>

当我从Google使用Firebase时,出现了一个奇怪的错误。 当我试图在这里使用此代码初始化Fire基地设置引用地址 let BASE_URL = "YOUR_FIREBASE_URL" var FIREBASE_REF = Firebase(url: BASE_URL) ,它显示一个错误: Cannot call value of non-function type 'module<Firebase>' 我的pod文件如下所示: # Uncomment this line to define a global platform for your project # platform :ios, '9.0' target 'Mission Board' do # Comment this line if you're not using Swift and don't want to use dynamic […]

默认应用程序尚未configuration

我正在尝试将我的应用升级到新版本的Firebase。 我浏览了设置指南,并编辑了所有的代码以匹配新的语法。 但是,当我运行应用程序,我得到这两个错误。 The default app has not been configured yet. Terminating app due to uncaught exception 'MissingDatabaseURL', reason: 'Failed to get FIRDatabase instance: FIRApp object has no databaseURL in its FirebaseOptions object.' 我在AppDelegate中有FIRApp.configure() ,并将GoogleServices-Info.plist导入到我的项目中。 plist也有所有正确的信息。 任何人遇到这个问题或知道如何解决它?

尝试在Swift中将Firebase时间戳转换为NSDate

我试图在Swift应用中使用Firebase时间戳。 我想将它们存储在我的Firebase中,并将它们用作本机NSDate对象。 文档说他们是unix时代,所以我试过了: NSDate(timeIntervalSince1970:FirebaseServerValue.timestamp) 没有运气。 这个: FirebaseServerValue.timestamp 回报 0x00000001199298a0 根据debugging器。 通过这些时间戳的最好方法是什么?

Firebase – 删除并重新安装应用程序不会取消对用户的身份validation

用下面的代码validation用户后(下面是我的代码的修剪版本,所以只有成功的login逻辑显示)… let firebaseReference = Firebase(url: "https://MY-FIREBASE.firebaseio.com") FBSession.openActiveSessionWithReadPermissions(["public_profile", "user_friends"], allowLoginUI: true, completionHandler: { session, state, error in if state == FBSessionState.Open { let accessToken = session.accessTokenData.accessToken firebaseReference.authWithOAuthProvider("facebook", token: accessToken, withCompletionBlock: { error, authData in if error != nil { // Login failed. } else { // Logged in! println("Logged in! \(authData)") } }) } }) } […]

如何解决无法获取默认令牌错误?

在iPhone中安装后,我得到这个错误。