标题说明了一切。我想我已经尝试了所有可能的组合,但它们似乎都不起作用。
我究竟做错了什么 ?
第一的 :
client.getSpace('<SPACEID>')
.then((space) => {
space.updateEntry({
"sys": {
id: "<ENTRYID>",
version:45
},
"fields": {
"job": {
"fr-FR": "blablabla"
}
}
})
})
=> 未处理的承诺拒绝类型错误:space.updateEntry 不是函数
第二 :
client.getSpace('<SPACEID>')
.then((space) => {
space.getEntry(<ENTRYID>)
.then((entry) => {
var ver = entry.sys.version
var id = entry.sys.id
entry = {
"sys":{
id: id,
version:ver
},
"fields": {
"job": {
"fr-FR": "blablabla"
}
}
}
entry.update()
})
})
=> 得到 entry.update() 不是一个函数
第三 :
.then((space) => {
space.getEntry(entryId)
.then((entry) => {
entry.fields.job = {"fr-FR": "blabla"}
entry.update()
})
})
=> 得到异常'-[__NSCFNumber 长度]:无法识别的选择器发送到实例 0xb0000000000002d3'
第四 :
entry.fields.job['fr-FR'] = 'blabla'
=> 同样的例外
ExceptionsManager.js:78 Exception '-[__NSCFNumber length]: unrecognized selector sent to instance 0xb000000000000013' was thrown while invoking sendRequest on target RCTNetworking with params (
{
data = {
string = "{\"fields\":{\"fireid\":{\"fr-FR\":\"bla\"},\"commission\":{\"fr-FR\":\"bla\"},\"dep\":{\"fr-FR\":\"bla\"},\"desc\":{\"fr-FR\":\"bla\"},\"email\":{\"fr-FR\":\"thp@ggg.com\"},\"firstname\":{\"fr-FR\":\"firstname\"},\"job\":{\"fr-FR\":\"blabla\"},\"name\":{\"fr-FR\":\"name\"},\"tel\":{\"fr-FR\":\"0675234573\"},\"type\":{\"fr-FR\":\"Collaborateur\"}}}";
trackingName = unknown;
};
headers = {
accept = "application/json, text/plain, */*";
authorization = "Bearer TOKEN";
"content-type" = "application/vnd.contentful.management.v1+json";
"x-contentful-user-agent" = "contentful-management.js/1.3.1";
"x-contentful-version" = 1;
};
incrementalUpdates = 0;
method = PUT;
responseType = text;
timeout = 0;
url = "https://api.contentful.com:443/spaces/<SPACEID>/entries/<ENTRYID>";
},
139
)