swift - Alamofire self-signed certificate issue -
i'm pretty new in ios development want send http request cisco server (which have self-signed certificate ) , have error in code
same topic https://github.com/alamofire/alamofire/issues/819
but said, i'm beginner understand what's going on in topic
so need whole code change url ip , change basic auth (username, password) , can work
here's code returns "the certificate server invalid. might connecting server pretending “10.123.1.123” put confidential information @ risk." error
import uikit import alamofire class indoornavvc: uiviewcontroller { override func viewdidload() { super.viewdidload() let user = "testforcisco" let password = "password" alamofire.request("myip") .authenticate(user: user, password: password) .responsejson { response in debugprint(response) } }
update: i'm set info.plist to
<key>nsapptransportsecurity</key> <dict> <key>nsexceptiondomains</key> <dict> <key>10.34.250.12/api/location/v2/clients/count</key> <dict> <key>nsexceptionallowsinsecurehttploads</key> <true/> <key>nsexceptionrequiresforwardsecrecy</key> <false/> <key>nsincludessubdomains</key> <true/> <!-- optional: specify minimum tls version --> <key>nstemporaryexceptionminimumtlsversion</key> <string>tlsv1.2</string> </dict> </dict> </dict>
which reference alamofire doc [secuiry paragraph] . https://github.com/alamofire/alamofire
Comments
Post a Comment