Coder Social home page Coder Social logo

Failed to install about swifthttp HOT 9 CLOSED

daltoniam avatar daltoniam commented on July 24, 2024
Failed to install

from swifthttp.

Comments (9)

daltoniam avatar daltoniam commented on July 24, 2024

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.

dzpt avatar dzpt commented on July 24, 2024

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.

acmacalister avatar acmacalister commented on July 24, 2024

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”."

https://developer.apple.com/library/ios/documentation/General/Conceptual/ExtensibilityPG/ExtensionScenarios.html

from swifthttp.

dzpt avatar dzpt commented on July 24, 2024

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.

acmacalister avatar acmacalister commented on July 24, 2024

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.

dzpt avatar dzpt commented on July 24, 2024

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.

acmacalister avatar acmacalister commented on July 24, 2024

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.

dzpt avatar dzpt commented on July 24, 2024

I just tried with PHP and didn't return nil, but tried with your class and NSURLSession, it's will return nil.

from swifthttp.

acmacalister avatar acmacalister commented on July 24, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.