Created
January 2, 2018 04:49
-
-
Save moozzyk/48b7612fd4cb46c31647a92f0e0aa86c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. Install/Upgrade carthage package manager (e.g. using brew or pkg) - link to github repo | |
2. Create a new Cocoa/Swift app | |
3. Create a new file called `Cartfile` in the application folder | |
4. Add `github "moozzyk/SignalR-Client-Swift" master` to the file to get the latest version (releases, tags in the future) | |
5. Run `carthage update --platform macOS` (--platform can be skipped to install for iOS and tvOS) | |
6. Add SignalRClient and SockertRocket to "Embedded Binaries" | |
7. Add SignalRClient and SocketRocket to "Linked Frameworks and Libraries" (Note 6. should do this automatically) | |
8. Add `import SignalRClient` to import SignalR client definitions | |
9. When using http you will likely see this error: | |
SignalRApp[14409:1752344] App Transport Security has blocked a cleartext HTTP (http://) resource load since it is insecure. Temporary exceptions can be configured via your app's Info.plist file. | |
Optional(Error Domain=NSURLErrorDomain Code=-1022 "The resource could not be loaded because the App Transport Security policy requires the use of a secure connection." UserInfo={NSUnderlyingError=0x60000004e100 {Error Domain=kCFErrorDomainCFNetwork Code=-1022 "(null)"}, NSErrorFailingURLStringKey=http://localhost:5000/testhub, NSErrorFailingURLKey=http://localhost:5000/testhub, NSLocalizedDescription=The resource could not be loaded because the App Transport Security policy requires the use of a secure connection.}) | |
Workaround (https://stackoverflow.com/questions/30731785/how-do-i-load-an-http-url-with-app-transport-security-enabled-in-ios-9): | |
In the info.plist | |
- Add "App Transport Security Settings" | |
- Under "App Transport Security Settings" add row - "Allow Arbitrary Domains" -> YES | |
9. Samples can be found in the repo: | |
https://github.com/moozzyk/SignalR-Client-Swift/blob/master/HubSample | |
https://github.com/moozzyk/SignalR-Client-Swift/tree/master/SocketsSample | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment