Event Delegate
The iOS SDK provides event delegates to listen to various events on the client app. Through these event delegates, TapTalk.io notifies the client app of events that happen on your app.
TapTalk.io provides seven types of event listeners to notify events to the client app. You will need to register the delegate objects to receive event callbacks from TapTalk.io.
Event Delegate Name
Description
Listens to general event changes in the application
Listens to UI-related events in Room List View when UI implementation type is used
Listens to UI-related events in Chat Room View when UI implementation type is used
Listens to custom keyboard-related events when UI implementation type is used
Listens to events when a new/updated message is received by the application
Listens to chat room status events such as typing events and online status
Listens to room list view controller lifecycle methods such as viewDidLoad, viewWillAppear, and many more.

TapTalkDelegate

General events such as notifications will be notified through TapTalkDelegate. A TapTalkDelegate instance is required when initializing TapTalk.
Note: Make sure to add #import <TapTalk/TapTalk.h> before registering the delegate
Objective-C
ViewController.m
1
//ViewController.m
2
3
#import <TapTalk/TapTalk.h>
4
5
//Add TapTalkDelegate declaration
6
@interface ViewController () <TapTalkDelegate>
7
8
@end
9
10
@implementation ViewController
11
12
- (void)function {
13
//Set TapTalk delegate to current
14
[[TapTalk sharedInstance] setDelegate:self];
15
}
16
17
#pragma mark - Delegate
18
#pragma mark TapTalk
19
- (void)tapTalkRefreshTokenExpired {
20
//Authentication is needed
21
}
22
23
- (void)tapTalkDidTappedNotificationWithMessage:(TAPMessageModel *_Nonnull)message fromActiveController:(nullable UIViewController *)currentActiveController {
24
//Handle tapped notification message
25
}
26
27
28
- (void)tapTalkUnreadChatRoomBadgeCountUpdated:(NSInteger)numberOfUnreadRooms {
29
// Returns number of unread messages from the application
30
}
31
32
- (void)tapTalkDidRequestRemoteNotification {
33
//Register for remote notification
34
[[UIApplication sharedApplication] registerForRemoteNotifications];
35
}
36
37
@end
Copied!
Method Name
Invoked When
tapTalkRefreshTokenExpired
User's refresh token has expired. Authentication with a new auth ticket is required.
tapTalkUnreadChatRoomBadgeCountUpdated:
The number of unread messages in the application is updated. Returns the number of unread messages from the application. Call method updateApplicationBadgeCount to update unread badge counter. You can see the function explanation in General section page.
tapTalkDidTappedNotificationWithMessage:
fromActiveController:
User tapped the notification.
tapTalkDidRequestRemoteNotification
TapTalk.io needs to request for push notification, usually client needs to add[UIApplication sharedApplication] registerForRemoteNotifications]inside the method.

TapUIRoomListDelegate

TapUIRoomListDelegate listens to UI-related events in Room List View when UI implementation type is used. You can register a TapUIRoomListDelegate instance in your application through the TapUI class as follows:
Note: Make sure to add #import <TapTalk/TapUI.h> before registering the delegate
Objective-C
ViewController.m
1
//ViewController.m
2
3
#import <TapTalk/TapUI.h>
4
5
//Add TapUIDelegate declaration
6
@interface ViewController () <TapUIRoomListDelegate>
7
8
@end
9
10
@implementation ViewController
11
12
- (void)function {
13
//Set TapUI delegate to current
14
[[TapUI sharedInstance] setRoomListDelegate:self];
15
}
16
17
#pragma mark - Delegates
18
#pragma mark TapUIRoomList
19
20
// Called when user click the profile button on the top right side of group chat room page.
21
- (void)tapTalkAccountButtonTapped:(UIViewController *)currentViewController
22
currentShownNavigationController:(UINavigationController *)currentNavigationController {
23
24
}
25
26
@end
Copied!
Method Name
Invoked When
tapTalkAccountButtonTapped:
currentShownNavigationController:
My account button in top left room list view is tapped by active user.
tapTalkUnreadChatRoomBadgeCountUpdated:

TapUIChatRoomDelegate

TapUIChatRoomDelegate listens to UI-related events in Chat Room View when UI implementation type is used. You can register a TapUIChatRoomDelegate instance in your application through the TapUI class as follows:
Note: Make sure to add #import <TapTalk/TapUI.h> before registering the delegate
Objective-C
ViewController.m
1
//ViewController.m
2
3
#import <TapTalk/TapUI.h>
4
5
//Add TapUIDelegate declaration
6
@interface ViewController () <TapUIChatRoomDelegate>
7
8
@end
9
10
@implementation ViewController
11
12
- (void)function {
13
//Set TapUI delegate to current
14
[[TapUI sharedInstance] setChatRoomDelegate:self];
15
}
16
17
#pragma mark - Delegates
18
#pragma mark TapUIChatRoom
19
20
// Called when a chat room is opened.
21
- (void)tapTalkChatRoomDidOpen:(TAPRoomModel *)room
22
currentViewController:(UIViewController *)currentViewController
23
currentShownNavigationController:(UINavigationController *)currentNavigationController {
24
25
}
26
27
// Called when a chat room is closed.
28
- (void)tapTalkChatRoomDidClose:(TAPRoomModel *)room
29
currentViewController:(UIViewController *)currentViewController
30
currentShownNavigationController:(UINavigationController *)currentNavigationController {
31
32
}
33
34
// Called when active user sends any message to a chat room.
35
- (void)tapTalkActiveUserDidSendMessage:(TAPMessageModel *)message
36
room:(TAPRoomModel *)room
37
currentViewController:(UIViewController *)currentViewController
38
currentShownNavigationController:(UINavigationController *)currentNavigationController {
39
40
}
41
42
// Called when user click the profile button on the top right side of the personal chat room view.
43
- (void)tapTalkChatRoomProfileButtonTapped:(UIViewController *)currentViewController
44
otherUser:(TAPUserModel *)otherUser
45
room:(TAPRoomModel *)room
46
currentShownNavigationController:(UINavigationController *)currentNavigationController {
47
48
}
49
50
// Called when user click the profile button on the top right side of the group chat room view.
51
- (void)tapTalkGroupChatRoomProfileButtonTapped:(UIViewController *)currentViewController
52
room:(TAPRoomModel *)room
53
currentShownNavigationController:(UINavigationController *)currentNavigationController {
54
55
}
56
57
// Called when user click the profile button on user in group.
58
- (void)tapTalkGroupMemberAvatarTappedWithRoom:(TAPRoomModel *)room
59
user:(TAPUserModel *)user
60
currentShownNavigationController:(UINavigationController *)currentNavigationController {
61
}
62
63
// Called when user click mention in the bubble chat.
64
- (void)tapTalkUserMentionTappedWithRoom:(TAPRoomModel *)room
65
mentionedUser:(TAPUserModel *)mentionedUser
66
isRoomParticipant:(BOOL)isRoomParticipant
67
message:(TAPMessageModel *)message
68
currentViewController:(UIViewController *)currentViewController
69
currentShownNavigationController:(UINavigationController *)currentNavigationController {
70
71
}
72
73
// Called when user click the quote view that appears in the chat bubble.
74
- (void)tapTalkMessageQuoteTappedWithUserInfo:(NSDictionary *)userInfo {
75
76
}
77
78
@end
Copied!
Method Name
Invoked When
tapTalkChatRoomDidOpen:
A chat room is opened. Returns the opened room, current shown view controller, and current shown navigation controller.
tapTalkChatRoomDidClose:
A chat room is closed. Returns the closed room, current shown view controller, and current shown navigation controller.
tapTalkActiveUserDidSendMessage:
Active user sends any message to a chat room. Message may not yet be delivered to the room when this happens. Returned message is temporary and the values will be updated through socket once the message is delivered.
tapTalkChatRoomProfileButtonTapped:
My account button in top left room list view is tapped by active user.
tapTalkUnreadChatRoomBadgeCountUpdated:
tapTalkGroupChatRoomProfileButtonTapped:
Profile button in a group chat room is tapped by active user. Returns the current shown navigation controller.
tapTalkGroupMemberAvatarTappedWithRoom:
A group member's profile picture on a message bubble in group chat room is tapped by active user. Returns the current shown navigation controller.
tapTalkUserMentionTappedWithRoom:
mentionedUser:
isRoomParticipant:
message:
currentViewController:
currentShownNavigationController:
Mention in bubble chat is tapped by active user. Returns current room, mentioned user data, boolean indicating the user is in group participant or not, message data, current shown view controller, and current shown navigation controller.
tapTalkMessageQuoteTappedWithUserInfo:
A quote inside a message bubble in a chat room is tapped by active user. Returns tapped message, and userInfo.
UserInfo is a dictionary object embedded inside a message containing data specified by client, and is generally null when not specified.

TapUICustomKeyboardDelegate

TapUICustomKeyboardDelegate bridges the custom keyboard-related events between TapTalk.io and the client app when UI implementation type is used. TapTalk.io will request custom keyboard items from the client app through this listener when a chat room is opened by the user. TapUICustomKeyboardDelegate can be implemented using the TapUI class.
Note: Make sure to add #import <TapTalk/TapUI.h> before registering the delegate
Objective-C
ViewController.m
1
//ViewController.m
2
3
#import <TapTalk/TapUI.h>
4
5
//Add TapUICustomKeyboardDelegate declaration
6
@interface ViewController () <TapUICustomKeyboardDelegate>
7
8
@end
9
10
@implementation ViewController
11
12
- (void)function {
13
//Set TapUI delegate to current
14
[[TapUI sharedInstance] setCustomKeyboardDelegate:self];
15
}
16
17
#pragma mark - Delegates
18
#pragma mark TapUICustomKeyboard
19
- (void)customKeyboardItemTappedWithRoom:(TAPRoomModel * _Nonnull)room
20
sender:(TAPUserModel * _Nonnull)sender
21
recipient:(TAPUserModel * _Nullable)recipient
22
keyboardItem:(TAPCustomKeyboardItemModel * _Nonnull)keyboardItem {
23
//Do an action when user taps a custom keyboard item
24
}
25
26
27
- (NSArray<TAPCustomKeyboardItemModel *> *)setCustomKeyboardItemsForRoom:(TAPRoomModel * _Nonnull)room sender:(TAPUserModel * _Nonnull)sender recipient:(TAPUserModel * _Nullable)recipient {
28
//Set custom keyboard option items
29
//Return items here if you wish to use custom keyboard in chat room
30
return [NSArray array];
31
}
32
33
@end
Copied!
To use custom keyboard in the chat room, return a list of TapCustomKeyboardItemModel on the setCustomKeyboardItemsForSender: method in this delegate. See the example below:
Objective-C
1
- (NSArray<TAPCustomKeyboardItemModel *> *)setCustomKeyboardItemsForRoom:(TAPRoomModel * _Nonnull)room sender:(TAPUserModel * _Nonnull)sender recipient:(TAPUserModel * _Nullable)recipient {
2
3
NSMutableArray *customKeyboardItemArray = [NSMutableArray array];
4
5
TAPCustomKeyboardItemModel *customKeyboardItem = [TAPCustomKeyboardItemModel new];
6
customKeyboardItem.itemName = @"Item 1";
7
customKeyboardItem.iconURL = @"Item Icon URL 1";
8
[customKeyboardItemArray addObject:customKeyboardItem];
9
10
TAPCustomKeyboardItemModel *customKeyboardItem2 = [TAPCustomKeyboardItemModel new];
11
customKeyboardItem2.itemName = @"Item 2";
12
customKeyboardItem2.iconURL = @"Item Icon URL 2";
13
[customKeyboardItemArray addObject:customKeyboardItem2];
14
15
return customKeyboardItemArray;
16
}
Copied!
Method Name
Invoked When
customKeyboardItemTappedWithRoom:
sender:
recipient:
keyboardItem:
A custom keyboard item in a chat room is tapped by the user. Returns custom keyboard item, room, sender user, and recipient user (only for personal chat room)
setCustomKeyboardItemsForRoom:sender:recipient:
Chat room is opened. TapTalk.io will request custom keyboard items from the client app to be displayed in the chat room. Returns room, sender user, and the recipient user (only for personal chat room)

TAPCoreMessageManagerDelegate

TAPCoreMessageManagerDelegate listens to events when a new/updated message is received by the application. TAPCoreMessageManagerDelegate can be registered through the TapCoreMessageManager class.
Note: Make sure to add #import <TapTalk/TapCoreMessageManager.h> before registering the delegate
Objective-C
ViewController.m
1
//ViewController.m
2
3
#import <TapTalk/TAPCoreMessageManager.h>
4
5
//Add TAPCoreMessageManagerDelegate declaration
6
@interface ViewController () <TAPCoreMessageManagerDelegate>
7
8
@end
9
10
@implementation ViewController
11
12
- (void)function {
13
//Set TAPCoreMessageManager delegate to current
14
[[TAPCoreMessageManager sharedManager] setDelegate:self];
15
}
16
17
#pragma mark - Delegates
18
#pragma mark TAPCoreMessageManager
19
- (void)tapTalkDidReceiveNewMessage:(TAPMessageModel *)message {
20
21
}
22
23
- (void)tapTalkDidReceiveUpdatedMessage:(TAPMessageModel *)message {
24
25
}
26
27
@end
Copied!
Method Name
Invoked When
tapTalkDidReceiveNewMessage:
A new message is received. Returns the newly received message.
tapTalkDidReceiveUpdatedMessage:
An updated message is received. Returns the newly received message.

TAPCoreChatRoomManagerDelegate

Room status events such as typing events and online status are notified through TAPCoreChatRoomManagerDelegate. An instance of TAPCoreChatRoomManagerDelegate can be registered from the TapCoreChatRoomManager class.
Note: Make sure to add #import <TapTalk/TapCoreChatRoomManager.h>before registering the delegate
Objective-C
ViewController.m
1
//ViewController.m
2
3
#import <TapTalk/TAPCoreChatRoomManager.h>
4
5
//Add TAPCoreChatRoomManagerDelegate declaration
6
@interface ViewController () <TAPCoreChatRoomManagerDelegate>
7
8
@end
9
10
@implementation ViewController
11
12
- (void)function {
13
//Set TAPCoreChatRoomManager delegate to current
14
[[TAPCoreChatRoomManager sharedManager] setDelegate:self];
15
}
16
17
#pragma mark - Delegates
18
#pragma mark TAPCoreChatRoomManager
19
- (void)tapTalkDidStartTypingWithUser:(TAPUserModel *)user roomID:(NSString *)roomID {
20
21
}
22
23
- (void)tapTalkDidStopTypingWithUser:(TAPUserModel *)user roomID:(NSString *)roomID {
24
25
}
26
27
- (void)tapTalkDidReceiveOnlineStatusWithUser:(TAPUserModel *)user onlineStatus:(BOOL)isOnline lastActive:(NSNumber *)lastActive {
28
29
}
30
31
@end
Copied!
Method Name
Invoked When
tapTalkDidStartTypingWithUser:roomID:
Another user starts typing a message in a chat room. Returns the room ID and typing user.
tapTalkDidStopTypingWithUser:roomID:
Another user stops typing a message in a chat room. Returns the room ID and typing user.
tapTalkDidReceiveOnlineStatus:
Another user comes online or offline. Returns the updated user, online status, and the updated user's last active time stamp.

TapUIRoomListViewControllerLifecycleDelegate

Room list view controller lifecycle events such as loadView, viewDidLoad, viewWillAppear and others are notified through TAPRoomListViewControllerLifecycleDelegate.
Note: Make sure to add #import <TapTalk/TapUI.h>before registering the delegate
Objective-C
ViewController.m
1
//ViewController.m
2
3
#import <TapTalk/TapUI.h>
4
5
//Add TapUIDelegate declaration
6
@interface ViewController () <TapUIRoomListViewControllerLifecycleDelegate>
7
8
@end
9
10
@implementation ViewController
11
12
- (void)function {
13
//Set TapUI delegate to current
14
[[[TapUI sharedInstance] roomListViewController] setLifecycleDelegate:self];
15
}
16
17
#pragma mark - Delegates
18
#pragma mark TapUIRoomListViewControllerLifecycle
19
20
- (void)TapUIRoomListViewControllerLoadView {
21
22
}
23
24
- (void)TapUIRoomListViewControllerViewDidLoad {
25
26
}
27
28
- (void)TapUIRoomListViewControllerViewWillAppear {
29
30
}
31
32
- (void)TapUIRoomListViewControllerViewWillDisappear {
33
34
}
35
36
- (void)TapUIRoomListViewControllerViewDidAppear {
37
38
}
39
40
- (void)TapUIRoomListViewControllerViewDidDisappear {
41
42
}
43
44
- (void)TapUIRoomListViewControllerDealloc {
45
46
}
47
48
- (void)TapUIRoomListViewControllerDidReceiveMemoryWarning {
49
50
}
51
52
@end
Copied!
Last modified 2mo ago