Comments (5)
@sbhklr I've pushed some changes to develop
that I believe will fix this issue. I am trying a different approach to what you've done in #37.
There is now a responseS3MetaData
serialization method that can be used.
I was unable to reproduce the crash. Could you confirm if this fixes the crash you are experiencing or not?
Thanks.
from amazons3requestmanager.
Your changes indeed fix it. A couple of notes:
- Shouldn't the initializer of
S3ObjectMetaData
return nil in case there are no headers available? - Shouldn't the completion handler be of type
completionHandler: Response<S3ObjectMetaData, NSError> -> Void
becauseResult.value
already returns an optional type. Otherwise I'd need to call it likeif let metaData = response.result.value?!.metaData {}
Suggestion:
public func responseS3MetaData(completionHandler: Response<S3ObjectMetaData, NSError> -> Void) -> Self {
return response(responseSerializer: Request.s3MetaDataResponseSerializer(), completionHandler: completionHandler)
}
static func s3MetaDataResponseSerializer() -> ResponseSerializer<S3ObjectMetaData, NSError> {
return ResponseSerializer { request, response, data, error in
guard error == nil else { return .Failure(error!) }
guard let response = response, metaData = S3ObjectMetaData(response: response) else {
let failureReason = "No response data was found."
let error = Error.errorWithCode(.DataSerializationFailed, failureReason: failureReason)
return .Failure(error)
}
return .Success(metaData)
}
}
from amazons3requestmanager.
Glad to hear this fixed the issue.
I'm sort of alright with the meta data being empty, but I can see your argument. I'll make that change as well. Hold tight. New version on the way.
I agree with your second point. I'm making a change right now to fix this. I'm also doing the same thing with the data serializer currently, so I'm going to fix that. This will cause minor API breaking changes.
from amazons3requestmanager.
from amazons3requestmanager.
Pushing the new version right now. Thanks for your comments and your initial PR on this. If the new version does not fix the issue, please feel free to re-open this issue.
from amazons3requestmanager.
Related Issues (20)
- errorWithCode(_:failureReason:) is deprecated in Alamofire
- Add operation to find bucket location
- Xcode 8 GM - Swift 2.3 fails to compile HOT 3
- please lower spec dependency to ios 8 HOT 9
- Remove CommonCrypto
- Add support for Pre-Signed URLs
- Break out Alamofire dependency into subspec
- Update `download` example in Readme HOT 4
- Issue for Alamofire 4.0.1 HOT 9
- S3BucketObjectList when using a delimiter doesn't extract the files correctly. HOT 2
- how to track the progress of uploading image or data or file to AS3RM HOT 1
- Example how get image from AWS and convert to UIImage? HOT 1
- Swift 2.3 release HOT 7
- Do amazonS3Manager.upload() function replace '+' character to white space character? HOT 2
- Chunk Upload & Download
- Add support multipart upload HOT 5
- Swift 4 support. HOT 2
- Xcode 9.0 beta compile error HOT 3
- Does not show any error on passing the wrong credentials HOT 1
- Can't compile several code snippets from Readme
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from amazons3requestmanager.