-
Notifications
You must be signed in to change notification settings - Fork 74
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using WKWebView does not work #15
Comments
But UIWebView does work for you? No issues connecting with WKWebView that I know of. What version of iOS are you trying with? |
Yes, UIWebView works fine. I tried using iOS 8.1 and 9.0 |
Are you using cookies for authentication by any chance? |
No cookies, no headers |
When you're running the app, use the Safari developer tools to watch the JavaScript console for your app. Do you see any errors when you try to connect? |
I do get an error: [Error] XMLHttpRequest cannot load http://<url_here>/signalr/signalr/negotiate?clientProtocol=1.5&connectionData=%5B%7B%22name%22%3A%22hub%22%7D%5D&_=1447840328641. Origin null is not allowed by Access-Control-Allow-Origin. |
Did you enable CORS on your server? Usually that looks like this: public class Startup
{
public void Configuration(IAppBuilder app)
{
app.UseCors (CorsOptions.AllowAll); // <-- This is the important part.
app.MapSignalR ();
}
} UIWebView does not respect CORS, but WKWebView does. I should probably mention this in the README. It would explain why UIWebView works for you, but WKWebView does not. |
You were right, it worked after updating the server. Thanks! |
Hi Adam, The connection does not succeed when using WKWebView instead of UIWebView. The log shows "Disconnected" right after "Start" is called (no matter how many times I try). I am using Swift 2.0 and I tried on simulator and also on multiple devices. The transport method is WebSockets (I also tried with Auto). Is this a known issue? Are you able to replicate it? Thanks.
The text was updated successfully, but these errors were encountered: