Closed tripleA-max closed 4 years ago
hi @tripleA-max ,
Thanks for reporting the issue, could you provide a code snippet of how you are trying to download the file? Or even a sample app repo that we can use to reproduce the issue?
I am having the same issue. With updated iOS 13, I am not able to download images or audio urls form the server. Same code is working for iOS 12.
My issue is solved. I had a custom xcconfig file setup for bundle identifier so referencing that file from Info.plist had caused this error.
My issue is solved. I had a custom xcconfig file setup for bundle identifier so referencing that file from Info.plist had caused this error. @PrekshyaBasnet Can you detail how you fixed this?
hi @tripleA-max ,
Thanks for reporting the issue, could you provide a code snippet of how you are trying to download the file? Or even a sample app repo that we can use to reproduce the issue?
@kneekey23
let transferUtility = AWSS3TransferUtility.default() var completionHandler: AWSS3TransferUtilityDownloadCompletionHandlerBlock? let completion: AWSS3TransferUtilityDownloadCompletionHandlerBlock = { (task, URL, data, error) -> Void in print(data) guard let data = data else { NSLog("Result: (URL), Error :(error)") return } NSLog("File downloaded - (data)") guard let stringify = String(data: data, encoding: String.Encoding.utf8) else { return } DispatchQueue.main.async { self.deserialize(myStringData: stringify, brand: self.brand) } }
My issue is solved. I had a custom xcconfig file setup for bundle identifier so referencing that file from Info.plist had caused this error. @PrekshyaBasnet Can you detail how you fixed this?
So I have a xcconfig file that my app reads App_name, Colors, etc from. I had added App_Bundle_Identifier = "com.example.A" in the configuration file and so change the info.plist to read from this config file as:
So I changed
And it worked. I debugged for the whole day just to find, that change had caused permission error in iOS 13.
@PrekshyaBasnet Thank you so much for this explanation. This did not seem to be the issue for me. My bundle identifier is and has always been $(PRODUCT_BUNDLE_IDENTIFIER) as I did not use an xcconfig file. I'm afraid this was not the solution to my problem. Thank you for your timely response though, it was very much appreciated.
hi @tripleA-max, from your code snippet
let transferUtility = AWSS3TransferUtility.default()
var completionHandler: AWSS3TransferUtilityDownloadCompletionHandlerBlock?
let completion: AWSS3TransferUtilityDownloadCompletionHandlerBlock = { (task, URL, data, error) -> Void in
print(data)
guard let data = data else {
NSLog("Result: (URL), Error :(error)")
return
}
NSLog("File downloaded - (data)")
guard let stringify = String(data: data, encoding: String.Encoding.utf8) else { return }
DispatchQueue.main.async {
self.deserialize(myStringData: stringify, brand: self.brand)
}
}
Can you clarify what is the call you are making with transferUtility
? The completion handler does look correct, that you can processing data only when there is no error.
You also mentioned this is working on the simulator and not on the device, and that this is related to file permissions. Are you downloading the object stored in S3 down to a specific URL?
Feel free to try out this sample to see if you can find any differences between your calling pattern and the one from the sample: https://github.com/awslabs/aws-sdk-ios-samples/tree/master/S3TransferUtility-Sample/Swift
For example, to download data specified by a key in S3, you can check out https://github.com/awslabs/aws-sdk-ios-samples/blob/master/S3TransferUtility-Sample/Swift/S3BackgroundTransferSampleSwift/DownloadViewController.swift
Hi, @lawmicha thanks for the response! I modified my code to match the implementation you provided in the samples but I am still experiencing this issue. The call I am making is a download data request to an existing S3 bucket.
transferUtility.downloadData( fromBucket: bucketName, key: keyName, expression: nil, completionHandler: completionHandler).continueWith { (task) -> AnyObject? in if let error = task.error { NSLog("Error: \(error.localizedDescription)") } if let _ = task.result { NSLog("Download Starting!") } return nil; } }
The transfer utility download does work on any device running iOS 12 or lower and on an iOS 13 sim. It's just a physical device running iOS13 where it doesn't.
maybe be related https://github.com/aws-amplify/aws-sdk-ios/issues/2314
@tripleA-max This issue is really strange cause the issue in iPad still persists. But the issue does not exist for iPhone anymore.
@PrekshyaBasnet Oh no way. Yea something with the SDK then maybe. Thank you so much for your feedback!
The transfer utility download does work on any device running iOS 12 or lower and on an iOS 13 sim. It's just a physical device running iOS13 where it doesn't.
Hi @tripleA-max , we just tried using the sample app and running it on a physical device on iOS 13.3.1 and things look fine. Could it be a setting on your device that is retricting some file permissions?
It appears you are also using an older SDK version, can you try again with the latest version? 2.13.0
Can you clarify, if the file permission error is coming from TransferUtility or after you have downloaded the data and writing to a file yourself? Did you reproduce this on the sample app or your own app?
Could it be a setting on your device that is retricting some file permissions?
Hi @lawmicha I thought that could be the issue, but it just isn't my device that has this issue. Any device I use running iOS 13 gives me this problem. I updated awhile back and I am using Cocoapods 2.12.7 and I am still seeing the issue. The error comes back from the AWSS3TransferUtilityDownloadCompletionHandlerBlock. The file that is being downloaded is being downloaded for the sake of displaying its contents, not to be saved or written to.
@PrekshyaBasnet Can you provide any more info on your issue with iPad?
@tripleA-max I have two targets, client1-app and client2-app. Both were not working for iOS 13+ in iPhone and iPad.
I updated referencing the bundle Id in info.plist -> https://github.com/aws-amplify/aws-sdk-ios/issues/2105#issuecomment-593716307, and it started working on iPhone and not in iPad. So I suspected there is issue related with info.plist and not anywhere.
Yesterday just for testing, I changed the bundle id and ran on the iPad and it works. So my issue was all related to info.plist.
Can you try changing bundle id and just see if it works that way? Just to see if its info.plist related problem.
Hi @tripleA-max This looks like an issue with Info.plist rather than a bug in SDK. Here are some resources that might help: com_apple_developer_default-data-protection encrypting_your_app_s_files
This issue has been automatically closed because of inactivity. Please open a new issue if are still encountering problems.
Hi, I'm wondering if you solved the issues @tripleA-max ? I'm experiencing this as well
I have experienced this issue and have been troubleshooting for way too many hours... My issues were apparently also caused by some mistake in my bundle identifier in my plist info file as described by @PrekshyaBasnet
Describe the bug My application is using the S3 transfer utility to download a file from S3. On xcode simulators running iOS 13.2.2, there appears to be no issue with download. However, when the application is run ad hoc on a device of the same OS version, the download fails and the error reads as follows: Error Domain=NSCocoaErrorDomain Code=257 "The file couldn’t be opened because you don’t have permission to view it." UserInfo={Server=AmazonS3, Accept-Ranges=bytes, Content-Type=application/json.. etc). This has been a problem since updating my device to iOS 13. After checking with the AWS Cognito and S3 support teams, it was concluded to be an issue with the SDK. To Reproduce Steps to reproduce the behavior:
Which AWS service(s) are affected?
Expected behavior The file from S3 should download.
Environment(please complete the following information):
Device Information (please complete the following information):