New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
repeating characters... #22
Comments
Are you using xCode 6 or 6.1? Can you share an example of the Swift code you used? |
I tried this out in Xcode 6.1 with my Github Swift project that is using SwfitHTTP against the Github API I was able to decode the JSON without any repeating characters. |
Also, do you have multiple requests going at once? If you call |
Maybe its because I'm out of date. I'm using Xcode Version 6.0.1 (6A317) Code is as simple as
|
I think that Xcode version should be ok, it is the version I am running. To narrow it down, can you try this for me: println("starting a request") //check to see if the request is run twice...
httpRequest.GET(path, parameters: nil, success: {(response: HTTPResponse) in
println("success!")
if response.responseObject != nil {
let data = response.responseObject as NSData
let str = NSString(data: data, encoding: NSUTF8StringEncoding)
println(str)
}
}, failure: {(error: NSError) in
println(error)
}) |
Oh snap. It is!
|
wait. duh. Sorry. That's because I am calling this twice in my call for two separate requests. They are two separate instances though. When I was using NSURLSession - the two request instances worked. |
Yeh so what I'm seeing is I'm entering in to the method that calls this http lib twice...but it only ever makes once request. |
yeah that makes sense. The println("starting a request") //check to see if the request is run twice...
httpRequest.GET(path, parameters: nil, success: {(response: HTTPResponse) in
dispatch_async(dispatch_get_main_queue(),{ //putting it on the main thread to make the logging look nice
println("success!")
if response.responseObject != nil {
let data = response.responseObject as NSData
let str = NSString(data: data, encoding: NSUTF8StringEncoding)
println(str)
}
})
}, failure: {(error: NSError) in
println(error)
}) |
Ah I see. I guess from a dev user UX, I would've expected the success callback to behave the same as NSURLSession dataTaskWithRequest's callback (or similar method). Thanks! This lib looks great. |
Sweet, thanks for the feedback! |
Just pulled this down to test it out. Looks great.
Pinged a local REST api and get the following
This is true with anything - errors, responses, etc. Repeats letters multiple times.
The text was updated successfully, but these errors were encountered: