小编tem*_*mp_的帖子

在本地运行云功能会出现错误"functions.config()不可用"

Firebase的Cloud Functions刚刚发布,我正在按照全新安装的说明进行操作.这是"开始使用"页面.

我已经安装了"npm install -g firebase-tools",我的所有文件都在我的项目中.我正在使用WebStorm 2016.3和Node.JS v6.10.0.

我安装了firebase登录和firebase init函数并进行了设置.我的设置. 这是我的设置.

我的package.json

 {
   "name": "functions",
   "description": "Cloud Functions for Firebase",
    "dependencies": {
     "firebase-admin": "^4.1.2",
     "firebase-functions": "^0.5"
   },
    "private": true
 }
Run Code Online (Sandbox Code Playgroud)

前两行代码工作正常.

  const functions = require('firebase-functions');
  const admin = require('firebase-admin');
Run Code Online (Sandbox Code Playgroud)

但是当我尝试运行这条线时......

  admin.initializeApp(functions.config().firebase);
Run Code Online (Sandbox Code Playgroud)

我收到这个错误.

 Error: functions.config() is not available. Please use the latest version of the Firebase CLI to deploy this function.
   at init (/Users/.../functions/node_modules/firebase-functions/lib/config.js:46:19)
   at Object.config (/Users/.../functions/node_modules/firebase-functions/lib/config.js:29:9)
   at Object.<anonymous> (/Users/.../functions/index.js:11:31)
   at Module._compile (module.js:570:32)
   at Object.Module._extensions..js (module.js:579:10)
   at Module.load (module.js:487:32)
   at tryModuleLoad …
Run Code Online (Sandbox Code Playgroud)

node.js firebase google-cloud-functions

35
推荐指数
3
解决办法
1万
查看次数

PHP Firebase帮助 - 设置JWT

在我的服务器上,我运行了几个读取我的Firebase实时数据库的PHP文件.根据Firebase的文档,我需要设置自定义令牌以使我的Firebase PHP客户端运行.Firebase文档说我需要退货;

  return JWT::encode($payload, $private_key, "RS256");
Run Code Online (Sandbox Code Playgroud)

我究竟如何参考JWT课程?我下载了一个JWT库,但我不知道如何在我的项目中实现它.任何帮助都会很棒,我主要是一名移动开发人员,对PHP几乎没有经验.

php firebase server firebase-authentication

6
推荐指数
1
解决办法
7690
查看次数

撤销当前的 APNs 密钥是否会破坏实时应用程序?

我在 App Store 中有一个应用程序,它通过 Firebase Cloud Messaging 使用推送通知。我当时为其创建了一个 APNs 密钥。我不再拥有密钥,并计划发布一个新的应用程序。我尝试创建一个新密钥,但 Devloper 门户表示我已达到此服务的密钥限制。如果撤销旧密钥是否会破坏我在 App Store 中已有的应用程序?对此最好的解决方案是什么?

apple-push-notifications ios swift firebase-cloud-messaging

6
推荐指数
1
解决办法
1900
查看次数

由于没有电池消耗,tvOS传输是否保持活跃状态​​?

两部分问题:

首先,Apple TV是否在睡眠时在后台运行应用程序活动?我认为这是因为Apple TV不依赖电池.

其次,如果不是这种情况,我将如何覆盖这使得应用程序保持运行并写入我的数据库?

我正在构建一个连接蓝牙LE的应用程序,然后在连接后写入数据库.我希望Apple TV成为我设备的"中心".因此,只要Apple TV能够保持清醒,与iOS不同,我应该没问题.我可能会以错误的方式看待这个问题.请随时纠正我.

tvos

5
推荐指数
1
解决办法
95
查看次数

多个BluetoothGattCharacteristic没有得到通知

我正在研究一个BLE设备,但我无法接听onCharacteristicChanged.我有8个BluetoothGattCharacteristic我需要订阅.

在找到设备后,onServicesDiscovered我开始一个订阅每个特征的过程.

private fun requestCharacteristics(gatt: BluetoothGatt, char: BluetoothGattCharacteristic){
        subscribeToCharacteristic(gatt, char, true)
        (charList).getOrNull(0)?.let {
            charList.removeAt(0)
        }
    }
Run Code Online (Sandbox Code Playgroud)

然后在subscribeToCharacteristic我做所有检查描述符.

private val CHARACTERISTIC_UPDATE_NOTIFICATION_DESCRIPTOR_UUID = UUID.fromString("00002902-0000-1000-8000-00805f9b34fb")

private fun subscribeToCharacteristic(gatt: BluetoothGatt, char: BluetoothGattCharacteristic, enable: Boolean) {
        if (gatt.setCharacteristicNotification(char, enable)){
            val descriptor = char.getDescriptor(CHARACTERISTIC_UPDATE_NOTIFICATION_DESCRIPTOR_UUID)
            if (descriptor != null){
                if (BluetoothGattCharacteristic.PROPERTY_NOTIFY != 0 && char.properties != 0) {
                    descriptor.value = BluetoothGattDescriptor.ENABLE_NOTIFICATION_VALUE
                } else if (BluetoothGattCharacteristic.PROPERTY_INDICATE != 0 && char.properties != 0) {
                    descriptor.value = BluetoothGattDescriptor.ENABLE_INDICATION_VALUE
                } else {
                    println("The …
Run Code Online (Sandbox Code Playgroud)

android kotlin bluetooth-lowenergy bluetooth-gatt

5
推荐指数
1
解决办法
278
查看次数

Firebase 分析事件参数未显示在控制台中

我一直在记录我的事件点击,这些点击似乎会显示出来,但我似乎无法在 Firebase 控制台中的任何位置找到参数。我所看到的只是:

具有自定义报告参数的事件将显示在此处

以下是我添加参数的方法:

var map = {'label': value};
_analytics.logEvent(name: 'session_button', parameters: map);
Run Code Online (Sandbox Code Playgroud)

我可以看到session_button出现在我的控制台中,但没有事件参数的数据。我错过了什么吗?

firebase flutter firebase-analytics

5
推荐指数
1
解决办法
6258
查看次数

将Objective-C malloc转换为Swift

我正在开发一个用Objective-C编写的项目,需要更新到Swift.我们使用C文件传输数据.

这是我在Objective-C中给出的代码:

- (NSData *)prepareEndPacket {
    UInt8 *buff_data;
    buff_data = (uint8_t *)malloc(sizeof(uint8_t)*(PACKET_SIZE+5));
    // Call to C File
    PrepareEndPacket(buff_data);
    NSData *data_first = [NSData dataWithBytes:buff_data length:sizeof(uint8_t)*(PACKET_SIZE+5)];
    return data_first;
}
Run Code Online (Sandbox Code Playgroud)

在C .h文件中我有这个参考:

#define PACKET_SIZE     ((uint32_t)128)
Run Code Online (Sandbox Code Playgroud)

我似乎找不到将其转换为Swift的好方法.任何帮助,将不胜感激.

objective-c ios swift

4
推荐指数
1
解决办法
383
查看次数

在 Dart 中将 int 转换为 Uint8

我正在使用ffityed_dataDart 库,并不断遇到这行代码的错误,

 Uint8 START_OF_HEADER = 1 as Uint8;
Run Code Online (Sandbox Code Playgroud)

我的错误:

类型“int”不是类型转换中“Uint8”类型的子类型

我在这里做错了什么?另一个奇怪的事情是,我可以使用这些库编写这行代码,并且我的 IDE 将编译并且不会抛出错误,直到您使用该行代码。我正在使用 Intellij 版本 2019.2.4

dart flutter dart-ffi

3
推荐指数
1
解决办法
2014
查看次数