在网上搜了signalr的oc客户端,基本上都指向同一个东西https://github.com/DyKnow/SignalR-ObjC
但是这个也有日子没更新了,用cocoapods安装下来是编译不过的。
在issue里有人说,需要吧pods的引用改为
platform :ios, '7.0'
pod 'AFNetworking', '1.3.3'
pod 'SignalR-ObjC'
指定AFNetworking的版本为1.3.3,安装下来编译通过。
不要高兴的太早。
按照简单的建立hub的方式连接服务器。
//Client
3:
// Connect to the service
];
// Create a proxy to the chat service
];
perform:self selector:@selector(addMessage:)];
// Start the connection
10: [hubConnection start];
11:
void)addMessage:(NSString *)message {
// Print the message when it comes in
14: NSLog(message);
15: }