Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/120.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 在signer-Objective C中调用hub方法_Ios_Objective C_Signalr - Fatal编程技术网

Ios 在signer-Objective C中调用hub方法

Ios 在signer-Objective C中调用hub方法,ios,objective-c,signalr,Ios,Objective C,Signalr,我是ios开发新手。我正在尝试实现信号R。我尝试了,并且能够连接到集线器。但是我不知道如何调用hub方法CheckWebServiceStatus 我发现了错误 “SRHubProxy”没有可见的@interface声明选择器“invoke:” 这是我的代码 #import "ViewController.h" #import "SignalR.h" @interface ViewController () @end @implementation ViewController - (v

我是ios开发新手。我正在尝试实现信号R。我尝试了,并且能够连接到集线器。但是我不知道如何调用hub方法
CheckWebServiceStatus

我发现了错误

“SRHubProxy”没有可见的@interface声明选择器“invoke:”

这是我的代码

#import "ViewController.h"
#import "SignalR.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.


    SRHubConnection *hubConnection = [SRHubConnection connectionWithURLString:@"https://MY HUB URL HERE/"];

    // Create a proxy to the chat service
    SRHubProxy *chat = [hubConnection createHubProxy:@"chatHub"];
    [chat on:@"addMessage" perform:self selector:@selector(addMessage:)];

    // [chat on:@"addMessage" perform:self selector:@selector(addMessage:)];

    // Register for connection lifecycle events
    [hubConnection setStarted:^{
        NSLog(@"Connection Started");
      //  [connection send:@"CheckWebServiceStatus"];
        [chat invoke:@"CheckWebServiceStatus"];

    }];
    [hubConnection setReceived:^(NSString *message) {
        NSLog(@"Connection Recieved Data: %@",message);
    }];
    [hubConnection setConnectionSlow:^{
        NSLog(@"Connection Slow");
    }];
    [hubConnection setReconnecting:^{
        NSLog(@"Connection Reconnecting");
    }];
    [hubConnection setReconnected:^{
        NSLog(@"Connection Reconnected");
    }];
    [hubConnection setClosed:^{
        NSLog(@"Connection Closed");
    }];
    [hubConnection setError:^(NSError *error) {
        NSLog(@"Connection Error %@",error);
    }];
    // Start the connection
    [hubConnection start];

}


- (void)addMessage:(NSString *)message {
    // Print the message when it comes in
    NSLog(@"%@", message);
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


@end

有人能告诉我如何使用objective c调用hub方法吗?

这里是invoke方法的一个示例

- (void) sendOperatorMessage :(NSString*) visitorId Message:(NSString*) message OperatorId:(NSString*) operatorid Token:(NSString*) ProfileToken SpinnerId:(NSString*) spinnerId CurrentDateTime:(NSString*) currentDateTime{

    [chat invoke:@"sendMessageOperator" withArgs:[NSArray arrayWithObjects:visitorId, message, operatorid, @"false", @"false", @"false", ProfileToken, currentDateTime, spinnerId, nil]];
}

下面是invoke方法的一个示例

- (void) sendOperatorMessage :(NSString*) visitorId Message:(NSString*) message OperatorId:(NSString*) operatorid Token:(NSString*) ProfileToken SpinnerId:(NSString*) spinnerId CurrentDateTime:(NSString*) currentDateTime{

    [chat invoke:@"sendMessageOperator" withArgs:[NSArray arrayWithObjects:visitorId, message, operatorid, @"false", @"false", @"false", ProfileToken, currentDateTime, spinnerId, nil]];
}