[ad_1]
I get the error under when downloading an audio file from Amplify Storage on an iOS system, each Simulator and a tool. All of it works completely advantageous when doing it on an Android emulator and system.
When downloading a JSON-file from the Storage it is engaged on each platforms with out errors.
The JSON I am downloading within the app as a visitor, whereas the audio file is downloaded as personal, however I do not see why this could make a distinction when it is engaged on Android.
StorageException(message: Surprising error occurred with message: Area: [NSCocoaErrorDomain
Code: [4
LocalizedDescription: [The file doesn’t exist.
LocalizedFailureReason: [The file doesn’t exist.
LocalizedRecoverySuggestion: [, recoverySuggestion: This should not happen. There is a possibility that there is a bug if this error persists. Please take a look at https://github.com/aws-amplify/amplify-ios/issues to see if there are any existing issues that match your scenario, and file an issue with the details of the bug if there isn't.
Issue encountered at: file: /Users/x/Documents/Github/TransscriberAI-App/Flutter/transscriber/ios/Pods/Amplify/Amplify/Categories/Storage/Error/StorageError.swift
function: recoverySuggestion line: 63, underlyingException: null)
Here is the code I use to download the file:
Future<String> getAudioPath(String key) async {
final docDir = await getTemporaryDirectory();
final filePath = docDir.path + '/audio/$key';
File file = File(filePath);
final S3DownloadFileOptions options = S3DownloadFileOptions(
accessLevel: StorageAccessLevel.private,
);
if (await file.exists()) {
return filePath;
} else {
try {
await Amplify.Storage.downloadFile(
key: key,
local: file,
options: options,
);
return filePath;
} on StorageException catch (e) {
print('Error downloading file: $e');
return 'null';
}
}
}
[ad_2]
