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

How to solve could not find member 'addListener'

Hi,

I followed this guide: http://www.pubnub.com/blog/realtime-ios-apps-getting-started-with-swift-and-pubnub/

for integrating pubnub with Swift.

In my AppleDelegate, I can publish messages fine, but I can't receive messages because

client?.addListener(self)

returns

could not find member 'addListner'.

Any help would be great,

var client:PubNub?

func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject:          AnyObject]?) -> Bool {
    let config = PNConfiguration( publishKey: "Your_Pub_Key", subscribeKey: "Your_Sub_Key")   

    client = PubNub.clientWithConfiguration(config)  

    client?.addListener(self)

    client?.subscribeToChannels(["Your_Channel"], withPresence: false)   

    client?.publish("Swift + PubNub!", toChannel: "demo", compressed: false, withCompletion: nil)
}

Thanks

Can we see a code sample from your app delegate? It's hard to offer help without knowing the context

Added code for the AppDelegate


Comments to this discussion are now closed!