Ios 未调用信号器Objc SRHUB连接委托
我们正在使用signalR Objc和CocoaPods(管理依赖关系)开发聊天应用程序。 已从下载的Signal_Objc 现在 我能够与服务器建立连接 用这些线Ios 未调用信号器Objc SRHUB连接委托,ios,objective-c,Ios,Objective C,我们正在使用signalR Objc和CocoaPods(管理依赖关系)开发聊天应用程序。 已从下载的Signal_Objc 现在 我能够与服务器建立连接 用这些线 @interface AQViewController : UIViewController<SRConnectionDelegate> { SRHubConnection *connection; SRHubProxy *hub; } @implementation AQViewControlle
@interface AQViewController : UIViewController<SRConnectionDelegate>
{
SRHubConnection *connection;
SRHubProxy *hub;
}
@implementation AQViewController
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
NSString *server = [Router sharedRouter].server_url;
connection = [SRHubConnection connectionWithURL:server];
hub = [connection createHubProxy:@"ConvoService"];
[connection setDelegate:self];
[connection start];
}
有什么想法吗??请提供帮助。尝试最后两个方法中的日志,可能会单击添加的日志以检查是否调用了这些方法,但什么也没有调用happened@sunitaKumari您能告诉我如何使用SignalR Objc库向服务器发送文本消息吗?因为无法在服务器上发送消息。为什么不将连接字符串(在viewDidLoad中)放入要连接函数并重试吗?
@interface AQViewController : UIViewController<SRConnectionDelegate>
{
SRHubConnection *connection;
SRHubProxy *hub;
}
-(IBAction)connect:(id)sender;
@end
#import "AQViewController.h"
#import "Router.h"
@interface AQViewController ()
@end
@implementation AQViewController
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
connection = [SRHubConnection connectionWithURL:@"http://medcomm.w08dev2.in.aquevix.com"];
hub = [connection createHubProxy:@"ConvoService"];
[connection setDelegate:self];
[connection start];
}
-(IBAction)connect:(id)sender{
NSString *authKey = @"815f35c0-1cfc-4154-a0c8-7ccb80465c6f23b7d170-3fa4-4a56- ad50-27c1d5f0390e";
NSMutableDictionary *dic = [[NSMutableDictionary alloc]init];
[dic setValue:authKey forKey:@"AuthKey"];
NSArray *arr = [NSArray arrayWithObjects:dic, nil];
NSLog(@"arr %@",arr);
[hub invoke:@"Connect" withArgs:arr completionHandler:^(id u){
NSString *str = (NSString *)u;
NSLog(@"Got connect response %@",str);
}];
}
- (void)SRConnectionDidOpen:(SRConnection *)connection
{
//AQSK
NSLog(@"get connected using HubConnection");
}
- (void)SRConnection:(SRConnection *)connection didReceiveData:(NSString *)data
{
//AQSK
NSLog(@"data recieved %@",data);
}
- (void)SRConnectionDidClose:(SRConnection *)connection
{
NSLog(@"close");
}
- (void)SRConnection:(SRConnection *)connection didReceiveError:(NSError *)error
{
NSLog(@"error%@",error.description);
}