Development Platform: Mac OS 10.14.6
Unity Version : 2018.4.10f1
Target Mobile OS : iOS 13.0
Firebase Version : 6.8.0
Scenario
There is a file in the local disk which I want to upload it to a server. The file (_filePath) is checked for it's existence. If present the coroutine uploadADummyFIle() is called. Nothing else matters but a simple upload method.
Issue
It works perfectly on my desktop but when I build it on my iOS device - the task "_resultTask" is always faulted. The error code is -13010. The error is
Code
private IEnumerator uploadADummyFIle(){ // This coroutine is only call when _filePath as a file existsStorageReference _fileReference = Session.StorageContentNodeFor(_fileName);
Task _uploadTask = _fileReference.PutFileAsync(_filePath, null, new Firebase.Storage.StorageProgress<UploadState>(_state => { float _percentage = (_state.BytesTransferred / _state.TotalByteCount); Debug.Log("Progress => " + _percentage); }), CancellationToken.None, null);
_uploadTask.ContinueWith (_resultTask => {
if (_resultTask.IsFaulted == true) { int _error = getExceptionFor(_resultTask); UnityEngine.Debug.Log("Upload FAULTED"); UnityEngine.Debug.Log(_error);// Always -13010 }
if (_resultTask.IsCanceled == true) { int _error = getExceptionFor(_resultTask); UnityEngine.Debug.Log("Upload CANCELLED"); UnityEngine.Debug.Log(_error);
} Debug.Log("Upload Completed -> " + _resultTask.IsCompleted); }); }
int getExceptionFor(Task _errorTask){ if (_errorTask.Exception is System.AggregateException _aggregateException) { if (_aggregateException.InnerExceptions[0] is StorageException _innerException) { return _innerException.ErrorCode; } }
return -1;} string _filePath = filePath;
#if UNITY_IOS && (!UNITY_EDITOR) _filePath = string.Concat("file://", filePath);#endif