Javascript 错误:indexedDB,准备要存储在对象存储中的Blob/文件时出错
Im使用DexieJS来使用IndexedDB-但是,在IOS Safari上,Im有时会出现错误:error:IndexedDB,准备存储在对象存储中的Blob/文件时出错 这不是始终如一的,这很奇怪。。。我正在尝试在数据库中存储“文件对象”。。。这似乎只发生在Safari的IOS上 im存储的一个示例是: 有人经历过同样的情况,有人知道解决方案吗 保存整个事件的代码:Javascript 错误:indexedDB,准备要存储在对象存储中的Blob/文件时出错,javascript,ecmascript-6,indexeddb,dexie,Javascript,Ecmascript 6,Indexeddb,Dexie,Im使用DexieJS来使用IndexedDB-但是,在IOS Safari上,Im有时会出现错误:error:IndexedDB,准备存储在对象存储中的Blob/文件时出错 这不是始终如一的,这很奇怪。。。我正在尝试在数据库中存储“文件对象”。。。这似乎只发生在Safari的IOS上 im存储的一个示例是: 有人经历过同样的情况,有人知道解决方案吗 保存整个事件的代码: savePendingSurvey = (id, currentSurvey, surveyAnswers, survey
savePendingSurvey = (id, currentSurvey, surveyAnswers, surveyFiles) => {
deletePendingSurveyByID(id);
const updatedSurvey = {
id: id,
createdAt: new Date(),
status: 'UNSUBMITTED',
surveyVersion: currentSurvey.survey.version,
currentSurvey: currentSurvey.survey,
currentSurveyAnswers: surveyAnswers,
currentSurveyFiles: surveyFiles
};
console.log(updatedSurvey);
db.pendingSurveys.add(updatedSurvey).then((response) => {
console.info('done adding pending survey', response);
}).catch('InvalidStateError', e => {
// Failed with InvalidStateError
alert('InvalidState error:' + e.message);
}).catch(Error, e => {
// Any other error derived from standard Error
alert('Error saving survey: ' + e.message);
}).catch(e => {
// Other error such as a string was thrown
alert(e);
}).catch((e) => {
if ((e.name === 'QuotaExceededError') ||
(e.inner && e.inner.name === 'QuotaExceededError')) {
// QuotaExceededError may occur as the inner error of an AbortError
alert('Quota exceeded error! - It seems there are not enough space available on your device for us to save the survey');
} else {
// Any other error
alert('Cant save your survey: ' + e + ' - ' + e.inner.name + ' - Please try closing the app and clear your cache, and try again');
}
});
};