【发布时间】:2018-05-27 21:00:38
【问题描述】:
我有一个名为 assets 的字典对象数组,当用 Swift 打印出来时,它显示:
[
["assetType": "video", "assetPath": "some_path"],
["assetType": "image", "assetPath": "some_other_path"]
]
这是完美的,但是,在我将其发送到我的 firebase 云功能并在云功能中打印出来后,assets 变为:
[
{
"assetType": ["video", "image"],
"assetPath": ["some_path", "some_other_path"]
}
]
为什么会这样?我该如何解决这个问题?
------------------更新------------- -----------------
我使用Alamofire模块来执行http请求:
Alamofire.request(
"https://....",
method: .post,
parameters: [
"assets": assets
]
)
------------------更新 2------------ ------------------
我的云功能如下:
exports.testFunction = functions.https.onRequest((req, res) => {
const { assets } = req.body;
return res.status(200).send(assets)
})
一被调用就立即发回assets
【问题讨论】:
-
有人投票结束了这个问题,因为它离题了,因为它在问“为什么这段代码不起作用?”,首先,我不是在问这个问题,我个人认为我的代码应该是在职的。其次,如果我不能在这里问,你认为我应该去哪里问这个问题?
-
可能跟云功能有关。不是你的快速代码。
-
@S1LENTWARRIOR,谢谢你的回复,我的firebase云功能立即发回
assets,没有做任何事情。但不知何故,这发生了。我已经更新了这个问题
标签: ios swift firebase google-cloud-functions