2013-08-02 1 views
2

iOS 어플리케이션에서 SignalR-ObjC를 설정하려고합니다. 이미 문제가없는 서버에서 클라이언트로 호출을 테스트했습니다. 아직 invoke 메서드를 작동시키지 못했습니다. 난 아무것도이 호출에서 서버를 공격 내가 본되지 않은 서버 호출SignalR-ObjC가 서버 호출을 호출하지 않습니다.

-(void)registerDevice{ 
    NSString *os = [NSString stringWithFormat:@"%@%@", [[UIDevice currentDevice] systemName], [[UIDevice currentDevice] systemVersion]]; 
    NSString *jsonRegister = [NSString stringWithFormat:@"{\"ClientDeviceModel\": {\"ClientID\": \"%@\",\"HardwareInfo\": \"%@\",\"OS\": \"%@\",\"AppVersion\": \"%@\",\"MessageID\": %@}}", [[UIDevice currentDevice] name], [[UIDevice currentDevice]model], os, [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"], [NSString stringWithFormat:@"%.0f", [NSDate timeIntervalSinceReferenceDate]]]; 

    NSLog(@"%@", jsonRegister); 

    NSMutableArray *registerInfo = [[NSMutableArray alloc] init]; 
    [registerInfo addObject:jsonRegister]; 

    [janus invoke:@"RegisterClient" withArgs:registerInfo completionHandler:^(id response){ 
     NSLog(@"%@", response); 
    }]; 
} 

를 호출하고있어 어디 여기

나는 허브 연결

-(void)setupHubConnection{ 
    hubConnection = [SRHubConnection connectionWithURL:@"http://hostname/Janus.Web/"]; 
    janus = [hubConnection createHubProxy:@"syncHub"]; 

    [janus on:@"picture" perform:self selector:@selector(checkStuff:)]; 
    [janus on:@"registrationResponse" perform:self selector:@selector(gotRegistered:)]; 

    [hubConnection start]; 

    [self registerDevice]; 
} 

을 설정하고있어 어디와 여기에 RegisterClient 호출입니다.

아이디어가 있으십니까?

답변

3

알아 냈어. [hubConnection start]을 호출 한 직후 registerDevice를 호출하려고했습니다. 대신 이제는 다음을 사용하고 있습니다.

-(void)SRConnectionDidOpen:(SRHubConnection*)connection{ 
    [self registerDevice]; 
} 

및 연결 위임을 자체로 설정하고 있습니다.

+0

이 게시물을 찾기 전에이 동일한 문제를 약 5 시간 동안 디버깅했습니다. +1, 이걸 알아 줘서 고마워, SignalR IOS 문서는별로 도움이되지 않습니다. – Jsdodgers

관련 문제