2016-12-15 12 views
1

iosの新機能です。私はSignal Rを実装しようとしています。私は試しましたが、私はハブに接続することができます。しかし、私は、ハブ法CheckWebServiceStatussignalRのハブメソッドを呼び出す - Objective C

私はエラーを取得していますを起動する方法がわからない

「SRHubProxy」の目に見える@interfaceはセレクタを宣言していない

「起動:」

ここに私のコードは、誰かがobjectiを使用してハブメソッドを呼び出す方法を私に伝えることができ

#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 

ですvec。ここで

答えて

0

は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]]; 
} 
の例です
関連する問題