The community forums are in BETA and closed to the public.

iOS OBSERVER: Error PubNub client connection failed, Connection Failed!

Hi PubNub Team, Kindly let me suggest what is the issue regarding this connection error like OBSERVER: Error PubNub client connection failed, Connection Failed!.

I have just copy the code from iOS docs and paste and run the code but its not works for me. Please help me and see below code as well as create new app and add publish and subscribe key but also that is not work for me.

// #1 Define client configuration
    PNConfiguration *myConfig = [PNConfiguration configurationForOrigin:@"pubsub.pubnub.com"
                                                             publishKey:@"demo"
                                                           subscribeKey:@"demo"
                                                              secretKey:nil];
    // #2 make the configuration active
    [PubNub setConfiguration:myConfig];
    // #3 Connect to the PubNub
    [PubNub connect];

    // #4 Add observer to look for connection events
    [[PNObservationCenter defaultCenter] addClientConnectionStateObserver:self withCallbackBlock:^(NSString *origin, BOOL connected, PNError *connectionError){
        if (connected)
        {
            NSLog(@"OBSERVER: Successful Connection!");
        }
        else if (!connected || connectionError)
        {
            NSLog(@"OBSERVER: Error %@, Connection Failed!", connectionError.localizedDescription);
        }
    }];

Thanks Nikunj Jadav

Which version of our iOS SDK are you using. If you are not on the latest (v3.7.10.8 as of this reply) then please upgrade and try to reproduce. If you are able to reproduce than do with PNLogging enabled and send the log file (attach it please) to support with the full details of your use case and errors.


Comments to this discussion are now closed!