Tag: firebase云消息传递

FCM推送通知不适用于iOS 11

我使用Firebase作为后端。 我也使用FCM作为Firebase提供的function之一。 FCM在iOS 10中运行良好,但在切换到iOS 11之后,推送通知停止发送到用户设备,而我自己也没有收到Firebase控制台中的云function或通知部分发送的任何推送通知。 如何解决这个问题? 更新:我从Firebase Notifcations发送了几个推送通知,但他们没有来。 // MARK: – Push notification extension AppDelegate: UNUserNotificationCenterDelegate { func registerPushNotification(_ application: UIApplication) { // For iOS 10 display notification (sent via APNS) UNUserNotificationCenter.current().delegate = self let authOptions: UNAuthorizationOptions = [.alert, .badge, .sound] UNUserNotificationCenter.current().requestAuthorization( options: authOptions, completionHandler: {_, _ in }) // For iOS 10 data message […]

在您的项目中找不到有效的GoogleService-Info.plist

当我用Xcode 9 beta 4运行我的swift 3.2代码时,这是我得到的错误: *** Terminating app due to uncaught exception 'com.firebase.core', reason: '[FIRApp configure]; (FirebaseApp.configure() in Swift) could not find a valid GoogleService-Info.plist in your project. Please download one from https://console.firebase.google.com/.' 我已经有一个GoogleService-Info.plist文件,它的名字完全和它应该一样,并且是有效的。 有没有试用firebase或类似的东西?

如何更新Firebase DB中的特定值

我正在关注这个文件 。 以下是我的代码更新: func updateDealResultToServer(key:String,dealResult : String) { let post = ["dealResul": dealResult] let childUpdates = ["/komal_xyz/\(key)": post ] rootRef.updateChildValues(childUpdates) } 这是我的Firebase数据库结构: 我只想改变dealResult的值。 每当我尝试运行以上代码为特定的子节点像1473670100726 ,除了dealResul其他值被删除。

Swift /如何使用dispatch_group与多个被称为Web服务?

我正在使用dispatch_group调用Firebase请求函数,并在请求完成后得到通知,以便能够使用结果。 在这种情况下,我只是把一个打印语句。 func loadStuff() { dispatch_group_enter(group) myFirebaseFunction() { dispatch_group_leave(group) } dispatch_group_notify(group, dispatch_get_main_queue()) { print("done") } } func myFirebaseFunction(completionHandler: () -> ()) { let usersRef = firebase.child("likes") usersRef.observeEventType(.Value, withBlock: { snapshot in if snapshot.exists() { let sorted = (snapshot.value!.allValues as NSArray).sortedArrayUsingDescriptors([NSSortDescriptor(key: "date",ascending: false)]) for item in sorted { dict.append(item as! NSDictionary) } } completionHandler() }) } […]

使用Google Firebase同时上传多张图片

我在Swift iOS项目中使用Google Firebase。 我有我的应用程序的一部分,用户从他们的设备select超过1张照片上传。 我试图find将所有一次select的照片上传到Firebase存储的最佳做法。 我知道如何上传一张照片。 我查看了文档,没有看到上传多个NSData对象的方法,所以我只是运行一个for循环并单独上传每个图像? 谢谢! 所有的反馈意见。

当App在iOS 10的后台时,推送通知不会被收到

我正在使用FCM(Firebase云消息传递)在iOS中发送推送通知。 当App处于前台状态时,我可以收到通知。 但是当应用程序处于后台状态时,不会收到通知。 每当应用程序将进入前台状态,才会收到通知。 我的代码是: – (void)userNotificationCenter:(UNUserNotificationCenter *)center willPresentNotification:(UNNotification *)notification withCompletionHandler:(void (^)(UNNotificationPresentationOptions))completionHandler { // Print message ID. NSDictionary *userInfo = notification.request.content.userInfo; NSLog(@"Message ID: %@", userInfo[@"gcm.message_id"]); // Pring full message. NSLog(@"%@", userInfo); if( [UIApplication sharedApplication].applicationState == UIApplicationStateInactive ) { NSLog( @"INACTIVE" ); completionHandler(UNNotificationPresentationOptionAlert); } else if( [UIApplication sharedApplication].applicationState == UIApplicationStateBackground ) { NSLog( @"BACKGROUND" ); completionHandler( […]

Firebase云消息传递开发和发布configuration文件

我从Google云消息传递到Firebase云消息传递。 有了GCM,我不得不select沙箱选项。 如此处所述: https : //developers.google.com/cloud-messaging/ios/client#obtain_a_registration_token请参阅第3点。 要以debugging模式接收推送通知,我必须做这样的事情 [[GGLInstanceID sharedInstance] startWithConfig:instanceIDConfig]; _registrationOptions = @{kGGLInstanceIDRegisterAPNSOption:deviceToken, kGGLInstanceIDAPNSServerTypeSandboxOption:@YES}; 要从AppStore接收推送通知(例如TestFlight),我不得不说: kGGLInstanceIDAPNSServerTypeSandboxOption:@NO}; 现在我无法在Firebase中find这样的内容。 首先,我认为伟大的没有改变这些愚蠢的价值观了。 但是现在我不再在我的TestFlight应用程序中收到任何推送通知。 在我的debugging控制台,当我在设备上debugging时,一个输出是这样的: <FIRInstanceID/WARNING> APNS Environment in profile: development 这对本地debugging很有用,但在TestFlight中是不需要的。 (我不知道TestFlight应用程序是否会发生这种情况,因为我没有它们的控制台。) 所以我的问题是:有人知道我是否可以在Firebase中手动更改这个Sandbox选项? 谢谢, 西蒙

从“FIRRemoteConfigValue!”投射 到不相关的types“string”总是失败

在我的项目中,我有大约50个同样的警告。 自更新以来,我把我所谓的snapshot.value["something"] as! String我的所有functionsnapshot.value["something"] as! String snapshot.value["something"] as! String失败。 他们都曾经工作过。 我甚至没有使用RemoteConfigfunction。 我只想检索数据。 来自我的用户类的示例: init(snapshot: FIRDataSnapshot) { firstName = snapshot.value!["firstName"] as! String lastName = snapshot.value!["lastName"] as! String } 一个函数的例子(我可以给出更多的例子,但基本上更多的是相同的): func loadProfileImage(ref:FIRDatabaseReference) { ref.observeEventType(.Value, withBlock: {snapshot in let base64String = snapshot.value!["profileImgURL"] as! String let decodedData = NSData(base64EncodedString: base64String, options:NSDataBase64DecodingOptions.IgnoreUnknownCharacters) if let decodedImage = UIImage(data: decodedData!) { self.profileImgImageView.contentMode […]

在没有Cocoapods的情况下手动集成Firebase和Google Sign In SDK时重复的符号

在我现有的iOS项目中手动集成Firebase和Google Sign In SDK时,出现重复符号错误。 这里的相关SO问题没有帮助,因为它使用Cocoapods。 Firebase和Google Signin给出了重复的符号错误 我按时间顺序采取的步骤: 从下载的Firebase SDK(3.11.0)复制Analytics,Auth和Database文件夹以及Firebase.h文件到我的项目中并添加到目标中。 将GoogleService-Info.plist复制到项目中并添加到目标。 向其他链接器标志添加了-ObjC标志。 将下载的Google Sign In SDK(4.0.1)中的必要框架和软件包复制到我的项目中,并添加到目标中。 链接必要的框架和库。 这里是相关的项目结构: Firebase Analytics FirebaseAnalytics.framework FirebaseCore.framework FirebaseInstanceId.framework GoogleInterchangeUtilities.framework GoogleSymbolUtilities.framework GoogleToolboxForMac.framework Auth FirebaseAuth.framework GTMSessionFetcher.framework GoogleSignIn GoogleAppUtilities.framework GoogleSignIn.bundle GoogleSignIn.framework GoogleSignInDependencies.framework GoogleSymbolUtilities.framework (removed as Firebase Analytics already includes it) 这里是错误日志(截断): Ld /Users/Ehtesham/Library/Developer/Xcode/DerivedData/AddressBookGoogleMaps-hbtfxxvykazaogbfqnnraeuywtdt/Build/Products/Debug-iphonesimulator/AddressBookGoogleMaps.app/AddressBookGoogleMaps normal x86_64 cd /Projects/iOS/AddressBookGoogleMaps export IPHONEOS_DEPLOYMENT_TARGET=8.0 export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin" /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch […]

通过服务器端代码的Firebase通知

新的Firebase通知服务允许我们使用控制台用户界面向所有移动应用用户发送通知。 但是我找不到任何适用于Firebase通知服务的REST API。 我想通过基于事件的服务器端代码自动发送通知给移动用户。 Firebase通知服务是否具有可通过HTTP / S访问的API?