我正在尝试使用 Firebase Cloud Messaging 实现推送通知,我通过 Firebase 控制台发送消息。在 Firebase 控制台中撰写消息时,我将徽章编号设置为 1,如下图所示
在那之后,我在主屏幕中的应用程序图标将始终带有编号为“1”的徽章,即使我尝试卸载并重新安装它,但编号为“1”的徽章仍然存在。
但它只发生在我的 iPhone 上,如果我将它安装在另一部手机上,则不会显示徽章
我在 App 委托中使用此代码来触发推送通知
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate, MessagingDelegate, UNUserNotificationCenterDelegate {
var window: UIWindow?
var fcmTokenUser : String?
var firsTimeUsingApp = true
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
FirebaseApp.configure()
print(NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true).last! as String)
// To get FCM token that will be sent to APNS via Google FCM
if #available(iOS 10.0, *) {
// For iOS 10 display notification …Run Code Online (Sandbox Code Playgroud) 我想使用云函数后台触发器,所以当我在 Firestore 中删除用户数据时,我还想删除他们在 Firebase 存储中的个人资料图片。
userID 用作该图片的图像名称。并且图像位于 profilepicture 文件夹中
export const removeProfilePictureWhenDeletingUserData = functions.firestore
.document('userss/{userID}')
.onDelete((snap, context) => {
const userID = context.params.userID
// how to delete the image in here?
});
Run Code Online (Sandbox Code Playgroud)
我试图阅读文档,但我对如何实现该方法感到困惑:(。真的需要你的帮助。提前致谢
google-cloud-storage firebase google-cloud-functions firebase-admin google-cloud-firestore
我是Typescript的新手(实际上也是Javascript),我需要将下面两行javascript语法转换为Typescript
const gcs = require('@google-cloud/storage')();
const spawn = require('child-process-promise').spawn
Run Code Online (Sandbox Code Playgroud)
我试图这样写,但是不起作用:
import * as gcs() from '@google-cloud/storage'
import * as spawn.spawn from 'child-process-promise'
Run Code Online (Sandbox Code Playgroud) 我是编程新手,而且很快。我有一个这样的枚举
enum City : String {
case tokyo = "tokyo"
case london = "london"
case newYork = "new york"
}
Run Code Online (Sandbox Code Playgroud)
我可以从枚举原始值将该城市名称获取到数组中吗?我希望我能得到这样的东西:
let city = ["tokyo","london","new york"]
Run Code Online (Sandbox Code Playgroud)