Comments (9)
hmmm, seems like README is getting added to the tests build phase, I am looking over the framework and I don't see the README being included in either the tests or the frameworks. Might want to check your compile sources and make sure the README isn't getting added.
from swifthttp.
I've got fixed. But after drag SwiftHTTP.xcodeproj to my project. There is warning:
linking against dylib not safe for use in application extensions: /abc-fuoggbtddqnmntgfhyhnkpwkwtsm/Build/Products/Debug-iphonesimulator/SwiftHTTP.framework/SwiftHTTP
? so i can't call HTTPTask and SwiftHTTP.framework have red highlight
from swifthttp.
Are you using SwiftHTTP in an app extension? Per Apple's extensions docs:
"To configure an app extension target to use an embedded framework, set the target’s “Require Only App-Extension-Safe API” build setting to Yes. If you don’t, Xcode reminds you to do so by displaying the warning “linking against dylib not safe for use in application extensions”."
from swifthttp.
Many tks. It's working now.
I'm trying request to google translate:
`var gurl = "http://translate.google.com/translate_a/t?client=p&q=\(inp)&tsel=0&sl=fr&tl=en"
var request = HTTPTask()
request.GET(gurl, parameters: nil, success: {(response: HTTPResponse) in
if let data = response.responseObject as? NSData {
let str = NSString(data: data, encoding: NSUTF8StringEncoding)
println("response: \(str)") //prints the HTML of the page
}
},failure: {(error: NSError, response: HTTPResponse?) in
println("error: \(error)")
})`
But there is error:
error: Error Domain=HTTPTask Code=503 "An error occured" UserInfo=0x786d7680 {NSLocalizedDescription=An error occured}
from swifthttp.
Seems you got a HTTP 503 error from the server. I tried your code above and it worked fine for me.
response: Optional({"sentences":[{"trans":"hi","orig":"hi","translit":"","src_translit":""}],"src":"fr","server_time":10})
from swifthttp.
That's weird. I tried many times. But still returned 503 error.
I checked google translate header. so it's returned:
Content-Disposition: attachment; filename="f.txt"
so that means i need to read f.txt file ?
from swifthttp.
A 503 means "The server is currently unable to handle the request due to a temporary overloading or maintenance of the server. The implication is that this is a temporary condition which will be alleviated after some delay." I doubt Content-Disposition header has any relevance, as the response appears to be JSON payload. Since I tested again it is still working fine on my end, this doesn't appear to be an issue with SwiftHTTP and an issue with the server. I would suggest maybe using an HTTP client such as http://www.getpostman.com or curl and see if those also have the same issue.
http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html
http://www.w3.org/Protocols/rfc2616/rfc2616-sec19.html
from swifthttp.
I just tried with PHP and didn't return nil, but tried with your class and NSURLSession, it's will return nil.
from swifthttp.
Assuming "returning nil" means you are still getting an HTTP 503 error, it sounds like something environmental to your setup/testing. SwiftHTTP uses NSURLSession under the hood, so it makes sense that both would have the same issue. Your code above is still working for me, so I don't think there is anything from a SwiftHTTP standpoint we are going to be help with. I would suggest you review your environment/setup and see what you can find. Again, using Postman or curl can usually help you track down these issues.
from swifthttp.
Related Issues (20)
- Count is unavailable: there is no universally good answer, see the documentation comment for discussion HOT 5
- HTTP.POST() not working after screen-lock (iOS 9.3.5)
- How to handler download progress?
- 'count' is unavailable: there is no universally good answer, see the documentation comment for discussion
- failed in xcode9.3
- Pinning Trusted certs or keys HOT 2
- POST method parameters lost in traffic
- Parameters not converted properly when using arrays HOT 2
- Cannot upload file
- Progress closure seems broken
- Post objects array to server
- Ambiguous use of 'init(urlString:parameters:headers:cachePolicy:timeoutInterval:)'
- Retry a task?
- Why OperationQueue support has been removed?
- SSL Pinning - Code=-999 "cancelled" HOT 1
- Linux support ?
- Timeout
- 'taskMap' Dictionary related crashes in Operation.swift file HOT 3
- Cannot consume as Swift package
- SSL Pinning - Always failing
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 swifthttp.