Tag: firebase云消息传递

不从Firebase存储下载的图像

我正尝试从新的Firebase存储中将图像下载到本地文件。 为此,我使用Firebase提供的示例。 这是我的代码: func getTumbnails(imageName: String) { // Create a reference to the file you want to download let tumbnailRef = storageRef.child("tumbs/\(imageName)") // Create local filesystem URL let localURL: NSURL! = NSURL(string: "file:///local/tumbnails/\(imageName)") // Download to the local filesystem let downloadTask = tumbnailRef.writeToFile(localURL) { (URL, error) -> Void in if (error != nil) { print(error) […]

如何为iOS的FirebaseUIlogin添加背景图片?

我希望能够在FirebaseUIlogin屏幕的三个loginbutton(用于Google,Facebook和电子邮件)后放置背景图像。 FirebaseUIlogin是针对iOS,Android和Web的一种embedded式authentication解决scheme。 我遇到了iOS的麻烦。 Github上有一些build议,但还不够。 我首先初始化我的var customAuthPickerViewController : FIRAuthPickerViewController! 靠近ViewController.swift文件的顶部。 然后,这是我的ViewController.swift文件中的function,但它不工作。 当我点击注销button,应用程序崩溃,并没有显示任何背景图像。 // Customize the sign-in screen to have the Bizzy Books icon/background image func authPickerViewController(for authUI: FIRAuthUI) -> FIRAuthPickerViewController { customAuthPickerViewController = authPickerViewController(for: authUI) backgroundImage = UIImageView(image: UIImage(named: "bizzybooksbee")) backgroundImage.contentMode = UIViewContentMode.scaleAspectFill customAuthPickerViewController.view.addSubview(backgroundImage) return customAuthPickerViewController } 背景图像“bizzybooksbee”是一个通用图像集,1x,2x和3x图像已经加载到我的Assets.xcassets文件夹中。 这里是一个没有尝试实现背景图像的login屏幕的样子 。 更新:我能够让图像显示,与我在下面的评论中给出的代码,但它显示在loginbutton,如下图所示。 这是Jeffrey的帮助下的“平等”的图像:

如何用firebase发送图片推送通知使用swift 3

任何人都可以帮我发送这样的通知: 我正在使用Firebase通知。 当我发送通知时,我尝试将图像URL置于高级选项的值和密钥1中。 图像URL出现在debugging器中,但是当我的设备出现通知时,不会显示图像。 这是我的代码。 import UIKit import UserNotifications import Firebase import FirebaseInstanceID import FirebaseMessaging @UIApplicationMain class AppDelegate: UIResponder, UIApplicationDelegate { var window: UIWindow? let gcmMessageIDKey = "gcm.message_id" func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { // Register for remote notifications. This shows a permission dialog on first run, to // show […]

firebase,swift,ios – 无法获取默认标记Error Domain = com.firebase.iid Code = 6“(null)”

我正在做一个login应用程序,跟踪是否有人login。 我正在使用Firebase作为一种方式来做到这一点。 如果一个人不在firebase,他们不能login。 问题 我不断收到控制台错误 <FIRInstanceID / WARNING>无法获取默认标记Error Domain = com.firebase.iid Code = 6“(null)” 当我模拟应用程序。 当我尝试以Ash Dreyer身份login时,它不会login我。即使我已login到Firebase,也会多次单击它,所以应该将其注销并重新login。 火力地堡 { "Ash Dreyer" : { "activity" : "None", "current_status" : "IN", "num_of_logins" : 0, "total_hours" : 0, "type" : "mentor" }, "Bryton Moeller" : { "activity" : "None", "current_status" : "OUT", "num_of_logins" : 0, "total_hours" : 0, […]

就像Firebase中的button一样

我想为我的UITableViewCell创build一个像button。 到目前为止,我设法做的是每次button被点击时用+1来更新喜欢的数量。 然而,我只希望用户能够按下一次button,如果用户再次点击该button,则用户不喜欢该post – 就像Facebook的button一样。 如果有任何帮助,我通过Facebooklogin到我的应用程序。 我的代码: @IBAction func likeTapped(sender: AnyObject) { //print(pathDB) FIRDatabase.database().reference().child("feed-items").child(pathDB).observeSingleEventOfType(.Value, withBlock: { (snapshot) in // Get user value let antalLikes = snapshot.value!["likesForPost"] as! Int print(antalLikes) let dataPathen = self.pathDB print(dataPathen) self.updateTotalNoOfPost{ print("Updated") } // … }) { (error) in print(error.localizedDescription) } } func updateTotalNoOfPost(completionBlock : (() -> Void)){ let prntRef = […]

Firebase或Swift没有检测到变音符号

我在Firebase数据库/存储中发现了一些最古怪的东西。 问题是,我不知道Firebase或Swift是否没有检测到变音器,例如(ä,ö,ü)。 我使用Firebase做了一些简单的事情,例如将图片上传到Firebase存储,然后将其下载到tableview 。 例如,我的一些.png文件在标题中有元音变音( Röda.png )。 所以现在如果我下载它们,问题就会出现。 只有当我的下载url是nil ,如果文件名包含我所说的变音符号。 所以我尝试了一些替代方法,如HTML ö – &ouml; 。 但是这不起作用。 你们可以给我一些build议吗? 我不能用ö – o , ü – u等 这是在尝试将某些值设置为Firebase时, url nil时的代码: FIRStorage.storage().reference() .child("\(productImageref!).png") .downloadURLWithCompletion({(url, error)in FIRDatabase.database().reference() .child("Snuses").child(productImageref!).child("productUrl") .setValue(url!.absoluteString) let resource = Resource(downloadURL: url!, cacheKey: productImageref)

如何防止用户名在Firebase中重复注册?

我想防止重复的用户名,而signUpforms的用户input。 我已经创build了电子邮件login像下面,呃创build用户,然后用用户字典授权setValue。 但是,我使用Firebase安全设置进行堆叠,以及如何检查处理这种情况。 REF_BASE.createUser(email, password: pwd, withValueCompletionBlock: { .. REF_BASE.authUser(email, password: pwd, withCompletionBlock: { .. REF_USERS.childByAppendingPath(uid).setValue(user) 此处理总是响应错误。 REF_USERS.childByAppendingPath(uid).childByAppendingPath("username").setValue(user["username"]) { (error: NSError!, result: Firebase!) in if error != nil { print(error.localizedDescription) } else { self.REF_USERS.childByAppendingPath(uid).setValue(user) } } 这是我的安全规则,我如何修复一切可以防止重复的用户? "users": { ".read": "auth !== null", "$user": { "username": { ".read": "auth !== null", ".write": "newData.val() === auth.uid […]

IOS上传符号文件崩溃报告失败

/Users/appledev018/LarsonApp/Pods/FirebaseCrash/upload-sym-util.bash:335:错误:curl退出非零状态35。 你好 命令/ bin / sh发出错误,但没有返回一个非零的退出代码来指示失败 我按照指导来设置Firebase崩溃报告,当我运行我的项目得到以上错误 以下是我的脚本 echo "### hello world" GOOGLE_APP_ID=1:688585241582:ios:0203552cad37c112 echo "### hello google" "${PODS_ROOT}"/FirebaseCrash/upload-sym "${PROJECT_DIR}/ServiceAccount.json" echo "### hello"

Firebase云消息传递订阅多个令牌到一个主题

我有一个应用程序,允许用户创build一个帐户。 然后我将用户信息存储在Firebase数据库中。 我也存储所有的用户设备令牌,以防他们使用多个设备与一个帐户(iPhone,iPad,Android等)。 当用户订阅主题时,我希望能够将所有关联的设备令牌订阅到该主题,而不仅仅是他们当前正在使用的设备。 订阅主题时是否有指定标记的方法,以便他们可以在其所有设备上接收主题通知。

Swift – 如何处理FIRUserInfo的FB Auth的数据?

我刚刚启动了Firebase的新SDK 。 let facebookLogin = FBSDKLoginManager() facebookLogin.logInWithReadPermissions(["email"], fromViewController: self) { (facebookResult: FBSDKLoginManagerLoginResult!, facebookError: NSError!) in let credential = FIRFacebookAuthProvider.credentialWithAccessToken(FBSDKAccessToken.currentAccessToken().tokenString) FIRAuth.auth()?.signInWithCredential(credential) { (user, error) in 之后,一边获取Facebook的信息, 我遇到了一个问题, 我怎样才能处理所有的人呢? : var userData = ["id": FIRAuth.auth()?.currentUser?.uid as! AnyObject, // "accessToken": credential as! String, // "provider": user.provider!, "displayName": user?.providerData["displayName"], "email": user.providerData["email"] as! String, "profileImageURL": user.providerData["profileImageURL"] as! String, // "token": […]