How to realize HTTPS by using native api in Swift?

Discussion in 'iOS Programming' started by sallay, Apr 15, 2015.

  1. sallay macrumors newbie

    Joined:
    Mar 20, 2015
    #1
    I'd like to use Swift to write native api to realize HTTPS. There are some third-party frameworks, like RestKit、AFNetworking, but they are written in Objective-C and there might be some problems in future if I use them. So I want to use Swift and native api to implement HTTPS. It is easy to realize HTTPS. Only use NSURL and NSURLSession. And some people provide libraries, like https://github.com/daltoniam/SwiftHTTP

    But how to realize HTTPS? Do I need other classes, except NSURL and NSURLSession? Is there any demo or tutorial to refer to?

    And how to handle certificate of HTTPS? Is there any recommendation for HTTPS implemetation on iOS? Thanks a lot.
     
  2. North Bronson macrumors 6502

    Joined:
    Oct 31, 2007
    Location:
    San José
    #2
    Connecting Securely to a URL

    "Connecting to a URL via TLS is trivial. When you create an NSURLRequest object to provide to the initWithRequest:delegate: method, specify https as the scheme of the URL instead of http. The connection uses TLS automatically with no additional configuration."
     
  3. PhoneyDeveloper macrumors 68030

    PhoneyDeveloper

    Joined:
    Sep 2, 2008

Share This Page