This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<key>NSAppTransportSecurity</key> | |
<dict> | |
<key>NSAllowsArbitraryLoads</key> | |
<true/> | |
<key>NSExceptionDomains</key> | |
<dict> | |
<key>amazonaws.com</key> | |
<dict> | |
<key>NSThirdPartyExceptionMinimumTLSVersion</key> | |
<string>TLSv1.0</string> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let bucketName = "***** your bucket name *****" | |
var completionHandler: AWSS3TransferUtilityUploadCompletionHandlerBlock? | |
func uploadVideo(with resource: String,type: String){ //1 | |
let key = "\(resource).\(key)" | |
let resource = Bundle.main.path(forResource: resource, ofType: type)! | |
let Url = URL(fileURLWithPath: resource) | |
let expression = AWSS3TransferUtilityUploadExpression() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func initializeS3() { | |
let poolId = "***** your poolId *****" | |
let credentialsProvider = AWSCognitoCredentialsProvider( | |
regionType: .APSouth1, //other regionType according to your location. | |
identityPoolId: poolId | |
) | |
let configuration = AWSServiceConfiguration(region: .APSouth1, credentialsProvider: credentialsProvider) | |
AWSServiceManager.default().defaultServiceConfiguration = configuration | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let bucketName = "***** your bucket name *****" | |
func uploadFile(with resource: String, type: String) { //1 | |
let key = "\(resource).\(type)" | |
let localImagePath = Bundle.main.path(forResource: resource, ofType: type)! //2 | |
let localImageUrl = URL(fileURLWithPath: localImagePath) | |
let request = AWSS3TransferManagerUploadRequest()! | |
request.bucket = bucketName //3 | |
request.key = key //4 |