Recent searches


No recent searches

Smooch IOS SDK delegate not triggered



Posted Nov 28, 2023

#ifndef AuthDelegate_h

#define AuthDelegate_h

#import <Foundation/Foundation.h>

#import <Smooch/Smooch.h>

@interface MyAuthDelegate : NSObject <SKTAuthenticationDelegate>

- (void)onInvalidToken:(NSError *)error handler:(SKTAuthenticationCompletionBlock)completionHandler;

@end

#endif /* AuthDelegate_h */

//////////////////////////////////////////////

///// below is AuthDelegate.m ///

#import <Foundation/Foundation.h>

#import "AuthDelegate.h"

@implementation MyAuthDelegate

/**

*  Notifies the delegate of a failed request due to invalid credentials

*  @param completionHandler callback to invoke with a new token

*/

- (void)onInvalidToken:(NSError *)error handler:(SKTAuthenticationCompletionBlock)completionHandler

{

  // retrieve new token

  NSLog(@"Smooch onInvalidToken triggered nick:");

  completionHandler(@"fake token");  

}

@end

 

///////////// below is how I attach the delegate to Smooch ////

SKTSettings *customSettings = [[SKTSettings alloc] init];

      customSettings.integrationId =integrationId;

      MyAuthDelegate *tempDelegate = [MyAuthDelegate new]; // [[MyAuthDelegate alloc] init];

      customSettings.authenticationDelegate = tempDelegate;

      ConversationDelegate *conversationDelegate = [ConversationDelegate new];

      [Smooch setConversationDelegate:conversationDelegate];

      [Smooch initWithSettings:customSettings completionHandler:^(NSError * _Nullable error, NSDictionary * _Nullable userInfo) {

          if (error == nil) {

.......

......

 

The delegate function is not firing. I also tried the didDismissViewController on `SKTConversationDelegate`, it is also not firing. I think something serious is wrong with my understanding. I probably miss some fundermental concept. Thanks! 

 

 


0

1

1 comment

image avatar

Taylor Bowser

Zendesk Customer Care

Hi Shenxin Xu

Thanks for your post! I've opened a ticket on your behalf so we can grab additional details to troubleshoot this issue. 

 

0


Please sign in to leave a comment.

Didn't find what you're looking for?

New post