【问题标题】:Increase time interval in Firebase HTTPs Callable iOS Swift增加 Firebase HTTPs Callable iOS Swift 中的时间间隔
【发布时间】:2021-08-26 10:10:15
【问题描述】:
我正在使用我的 iOS Swift 代码,并已成功安装所有依赖项。
现在,我正在尝试增加 Firebase 函数中的 timeoutInterval。
functions.httpsCallable("getData").call(){ (result, error) in
guard error == nil else {
print(error)
return
}
.........
}
【问题讨论】:
标签:
ios
swift
firebase
google-cloud-functions
【解决方案1】:
您无法从客户端执行此操作。您将不得不增加函数的超时时间,例如:
const runtimeOpts = {
timeoutSeconds: 300,
memory: '1GB'
}
exports.getData = functions
.runWith(runtimeOpts)
https.onCall((data, ctx) = > {
// the function
});
timeoutSeconds 的最大值为 540,即 9 分钟。
详细信息可以在documentation找到
【解决方案2】:
我找到了答案。首先,您必须在 Firebase 服务器中设置时间,然后在客户端(Swift)中使用此代码:
functions.httpsCallable("getData").timeoutInterval = 120