Forum Xamarin.iOS
We are excited to announce that the Xamarin Forums are moving to the new Microsoft Q&A experience. Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

We encourage you to head over to Microsoft Q&A for .NET for posting new questions and get involved today.

Threads are finished and download is interrupted several times xamarin iOS from AWS S3

MuhammadBilal.8401MuhammadBilal.8401 USMember ✭✭
edited October 2018 in Xamarin.iOS

I am trying to download an XML file of size 85MB in my Xamarin iOS iPad App. Sometimes download completes successfully, but other times download hangs inbetween somewhere without giving any error, but threads finished. Progress stops.

AWS SDK version:



I tried both methods . Here is my code:
1- GetObject Method.

            var  clientRequest = new AmazonS3Client(AWSAccessKey,
                GetObjectRequest request = new GetObjectRequest
                    BucketName = AWSBucketName,
                    Key = Path + "File1.xml"
                using (GetObjectResponse response = await clientRequest.GetObjectAsync(request))
                 response.WriteObjectProgressEvent += displayDownloadProgress;
                 await response.WriteResponseStreamToFileAsync(destPath, false);                        
            catch (AmazonS3Exception e)
                Console.WriteLine("Error encountered ***. Message:'{0}' when writing an object", e.Message);
            catch (Exception e)
                Console.WriteLine("Unknown encountered on server. Message:'{0}' when writing an object", e.Message);

2- TransferUtility Method

            var utility = new TransferUtility(cas.AWSAccessKey,

            TransferUtilityDownloadRequest dr = new TransferUtilityDownloadRequest();
            dr.BucketName = AWSBucketName;
            dr.Key = Path + "File1.xml";
            dr.FilePath = destPath;
            dr.WriteObjectProgressEvent += displayDownloadProgress;
            await utility.DownloadAsync(dr);

            public void displayDownloadProgress(object sender, WriteObjectProgressArgs args)
                Debug.WriteLine("Download Progress: " + (args.PercentDone));

                InvokeOnMainThread(() =>
                    BTProgressHUD.ShowContinuousProgress("Download Progress: " + args.PercentDone.ToString() + "%", ProgressHUD.MaskType.Gradient);

                if (args.PercentDone >= 100)

---------------LOG OF Successful & Unsuccessful Application Output is attached in file---------------------

Sign In or Register to comment.