[Aerogear-users] iOS Troubleshooting when server uses a self-signed certificate Swift 3
Polina Koleva
polina.n.koleva at gmail.com
Mon May 29 12:27:59 EDT 2017
Hey :)
Julio Cesar Sanchez Hernandez wrote
> Hi.
>
> There is something missing on the email you sent.
>
> You said
> I added in my DeviceRegistration.swift file the method:
I have added the code but it is not visible in the email. I place it here
again (hopefully this time it will work). So this is the implementation of
the method:
public func urlSession(_session: URLSession, task: URLSessionTask,
didReceive challenge: URLAuthenticationChallenge, completionHandler:
(URLSession.AuthChallengeDisposition, URLCredential?) -> Void) {
if challenge.protectionSpace.authenticationMethod ==
NSURLAuthenticationMethodServerTrust && challenge.protectionSpace.host ==
serverURL.host! {
let credentials = URLCredential(trust:
challenge.protectionSpace.serverTrust!)
completionHandler(Foundation.URLSession.AuthChallengeDisposition.useCredential,
credentials)
} else {
completionHandler(Foundation.URLSession.AuthChallengeDisposition.cancelAuthenticationChallenge,
nil)
}
}
Julio Cesar Sanchez Hernandez wrote
> Do you see any error message on Xcode console? If yes, share them.
Yes, it is written that the server is not trusted because of the self-signed
certificate.
This is the error:
Error Registering with UPS: The certificate for this server is invalid. You
might be connecting to a server that is pretending to be “x.x.x.x” which
could put your confidential information at risk.
Julio Cesar Sanchez Hernandez wrote
> Do you have a paid Apple developer account?
Yes, I have a developer account.
Julio Cesar Sanchez Hernandez wrote
> Are you testing on a real device?
Yes, I am testing on a real device.
Julio Cesar Sanchez Hernandez wrote
> Is the device asking for the push permissions?
Yes, the app asks for permission to receive push notifications. But it
cannot connect to the server.
Julio Cesar Sanchez Hernandez wrote
> Is your server available online so I can take a look?
No, I am running the ups on my local machine.
Thanks.
On Mon, May 29, 2017 at 2:57 PM, Polina Koleva <polina.n.koleva@>
wrote:
> Hey,
> I am trying to run Swift 3 HelloWorld app ( HelloWorldSwift
> <https://github.com/aerogear/aerogear-ios-cookbook/tree/
> master/UnifiedPushHelloWorld>
> ) but I have a problem with the self-signed certificate.
> Looking at the documentation ( ios troubleshooting
> <https://aerogear.org/docs/unifiedpush/aerogear-push-ios/
> guides/#troubleshooting>
> ) and changing it a little bit for Swift 3 , I added in my
> DeviceRegistration.swift file the method:
>
>
>
> But it still doesn't work. The method is not invoked at all. Do I miss
> something?
>
> Any help will be appreciated.
>
> Polina
>
>
>
> --
> View this message in context: http://aerogear-users.1116366.
> n5.nabble.com/iOS-Troubleshooting-when-server-uses-a-self-signed-
> certificate-Swift-3-tp1115.html
> Sent from the aerogear-users mailing list archive at Nabble.com.
> _______________________________________________
> Aerogear-users mailing list
> Aerogear-users at .jboss
> https://lists.jboss.org/mailman/listinfo/aerogear-users
>
_______________________________________________
Aerogear-users mailing list
Aerogear-users at .jboss
https://lists.jboss.org/mailman/listinfo/aerogear-users
--
View this message in context: http://aerogear-users.1116366.n5.nabble.com/iOS-Troubleshooting-when-server-uses-a-self-signed-certificate-Swift-3-tp1115p1117.html
Sent from the aerogear-users mailing list archive at Nabble.com.
More information about the Aerogear-users
mailing list