If you are starting out with Twilio's Programmable Chat SDK for iOS, we highly recommend starting with version 4.x. Version 4.x is our latest SDK and it brings many new features and improvements to the 1.x and 2.x versions. And it will be much easier to migrate to Twilio Conversations.
Not using 4.x? You should migrate ASAP
If you are already using 2.x, we highly recommend planning your migration to 4.x as soon as possible.
End-of-Life for 1.x occurred on June 30, 2019.
joinChannel
callback. Sometimes it was not called.
makeUserDescriptor
.
isOnline
and
isNotifiable
methods in
TCHUserDescriptor
could return the wrong value.
addByIdentity:completion:
and
inviteByIdentity:completion
in
TCHMembers
.
channelWithCompletion:
.
member.subscribedUser(completion)
was not working after calling
unsubscribe()
method.
type
property to
TCHMember
userDescriptorWithCompletion
and
subscribedUserWithCompletion
from
TCHMember
subscribedUserWithIdentity:completion:
and
userDescriptorWithIdentity:completion:
from
TCHUsers
userDescriptorWithCompletion
and subscribedUserWithCompletion
from TCHMember
are available only for members of type chat
removeMember
from
TCHMembers
typingStartedOnChannel
/
typingStartedOnChannel
from
TwilioChatClientDelegate
TCHMessage
Features above lead to a significant increase in the size of the distributable. The increased size of the framework has no negative effect on installable applications distributed through App Store, they would remain of a similar size.
notificationLevel
can be either
TCHChannelNotificationLevelDefault
to receive notifications or
TCHChannelNotificationLevelMuted
to suppress them.
TCHChannelUpdateUserNotificationLevel
to
TCHChannelUpdate
enum - this update is triggered when channel's notification level is changed.
Added new token lifecycle management delegate callbacks which reduce the need for TwilioAccessManager integration when only using one Twilio client SDK:
chatClientTokenWillExpire:
is called when a token has 3 minutes or less left until expiry and should be refreshed
chatClientTokenExpired:
is called when a token is already expired and must be refreshed to reconnect to the service
TCHLogLevelTrace
, which provides the most verbose logging level for diagnostics. Use this value to generate logs when reporting SDK issues to Twilio. As before, default log setting is
TCHLogLevelSilent
, producing no SDK debug output at all.
TCHMemberUpdateAttributes
to
TCHMemberUpdate
enum. There's currently no way to query member attributes, it will be added in the following SDK version.
getMessages*
could result in a crash if called while client was shutting down.
TCHChannel
:
lastMessageDate
- the
NSDate
timestamp of the most recent message on the channel
lastMessageIndex
- the index of the most recent message on the channel
- (nonnull NSArray<TCHChannel *> *)subscribedChannelsSortedBy:(TCHChannelSortingCriteria)criteria order:(TCHChannelSortingOrder)order
TCHChannelSortingCriteriaLastMessage
TCHChannelSortingCriteriaFriendlyName
TCHChannelSortingCriteriaUniqueName
TCHChannelSortingOrderAscending
TCHChannelSortingOrderDescending
TCHChannelUpdateLastMessage
update type for
chatClient:channel:updated:
delegate method
getMessages*
methods for a channel whose last remaining message was deleted could cause a crash
TCHLogLevelSilent
, which is also the new default level. We strongly encourage customers use this logging level for production builds especially if serving European customers.
+ (BOOL)isExpired:(nonnull NSString *)token
+ (BOOL)isExpiring:(nonnull NSString *)token
nil
date objects - they parse consistently now.
body
attribute of messages containing media included the placeholder message intended for legacy client versions, potentially incorrectly inferring the client version did not support media attachments.
body
will now be
nil
if the
TCHMessage
has media content.
TwilioChatClient
to support three new notifications:
- (void)chatClient:(nonnull TwilioChatClient *)client notificationAddedToChannelWithSid:(nonnull NSString *)channelSid
- (void)chatClient:(nonnull TwilioChatClient *)client notificationInvitedToChannelWithSid:(nonnull NSString *)channelSid
- (void)chatClient:(nonnull TwilioChatClient *)client notificationRemovedFromChannelWithSid:(nonnull NSString *)channelSid;
chatClient:notificationNewMessageReceivedForChannelSid:messageIndex:
now consistently returns message index when a new message is received.
.sid
identifier to
TCHMember
objects.
joinWithCompletion:
or TCHMember's
addByIdentity:completion:
will now correctly return with a failure result if the user/identity is already a member of the channel instead of success.
The following methods have been deprecated and for now have the same effect as passing null/nil to the optional completion parameters introduced below:
_10- (void)setLastConsumedMessageIndex:(nonnull NSNumber *)index;_10- (void)advanceLastConsumedMessageIndex:(nonnull NSNumber *)index;_10- (void)setAllMessagesConsumed;_10- (void)setNoMessagesConsumed;
These methods are replaced with versions that take an optional completion block:
_10- (void)setLastConsumedMessageIndex:(nonnull NSNumber *)index completion:(nullable TCHCountCompletion)completion;_10- (void)advanceLastConsumedMessageIndex:(nonnull NSNumber *)index completion:(nullable TCHCountCompletion)completion;_10- (void)setAllMessagesConsumedWithCompletion:(nullable TCHCountCompletion)completion;_10- (void)setNoMessagesConsumedWithCompletion:(nullable TCHCountCompletion)completion;
The completion block will convey the newly updated unread message count for the channel for the current user.
These operations will also affect the value returned by TCHChannel's getUnconsumedMessagesCountWithCompletion:
method, causing the value returned by it to be up to date as of the consumption update the user just performed.
updateToken:completion:
once again give feedback if the provided token is expired or otherwise invalid.
joinChannel
sometimes was not called.
TCHMessage
were sometimes not fully populated by the time
sendMessage
's completion was called.
Important: The behavior of not-present optional data, such as friendlyName, uniqueName, etc, has changed with this release of Programmable Chat iOS to match the REST API and improve usability in Swift. We no longer return an empty string on missing data, returning instead nil. If you are relying on the previous behavior of empty string to be able to directly display these values in your application, you will need to check for the value instead.
With 2.x, we are moving Programmable Chat iOS releases to the global CocoaPods repository. We will no longer be posting non-beta releases for this SDK to the https://github.com/twilio/cocoapod-specs/ location. If you already have the global CocoaPods source in your Podfile no changes are necessary. If you do not have it, you will need to add source 'https://github.com/cocoapods/specs'
or remove the Twilio specific source line. No changes are necessary if you use manual integration of this SDK.
chatClient:channel:updated:
will no longer notify on
TCHChannelUpdateSynchronizationStatus
changes - see the
chatClient:channel:synchronizationStatusUpdated:
delegate call for these updates
createMessageWithBody:
is deprecated from
TCHMessages
. You now build a new message using the
TCHMessageOptions
object and send with
sendMessageWithOptions:completion:
Old:
_10 TCHMessage *message = [channel.messages createMessageWithBody:@"hello"];_10 [channel.messages sendMessage:message completion:^(TCHResult *result) { }];
New:
_10 TCHMessageOptions *options = [[TCHMessageOptions new] withBody:@"hello"];_10 [channel.messages sendMessageWithOptions:options completion:^(TCHResult *result, TCHMessage *message) { }];
Changes to nullability hints throughout entire public interface.
chatClient:channel:synchronizationStatusUpdated:
)
+ TCHMessageTypeText
+ TCHMessageTypeMedia
+ messageType
(ADDED
+ mediaSid
(ADDED)
+ mediaSize
(ADDED)
+ mediaType
(ADDED)
+ mediaFilename
(ADDED)
- hasMedia
(ADDED)
- getMediaWithOutputStream:onStarted:onProgress:onCompleted:completion:
(ADDED)
- createMessageWithBody:
(REMOVED)
- sendMessage:completion:
migrated to
-sendMessageWithOptions:completion:
completion now provides a handle to the new TCHMessage
With 1.x, we are moving Access Manager releases to the global CocoaPods repository. We will no longer be posting non-beta releases for this SDK to the https://github.com/twilio/cocoapod-specs/ location. If you already have the global CocoaPods source in your Podfile no changes are necessary. If you do not have it, you will need to add source 'https://github.com/cocoapods/specs'
or remove the Twilio specific source line. No changes are necessary if you use manual integration of this component.
updateToken:completion:
once again give feedback if the provided token is expired or otherwise invalid.
joinChannel
sometimes was not called.
TCHMessage
were sometimes not fully populated by the time
sendMessage
's completion was called.
join
method will be delayed until the channel is fully synchronized, guaranteeing availability of members and messages objects.
chatClient:channel:synchronizationStatusUpdated:
delegate method was not called.
getLastMessagesWithCount:completion:
could hang.
shutdown
sometimes caused New Message push registrations to be lost for the endpoint.
userInfo
migrated to user
chatClientWithToken:properties:delegate:
migrated to
chatClientWithToken:properties:delegate:completion:
updateToken:
migrated to
updateToken:completion:
+users
(ADDED)
registerWithToken:
migrated to
registerWithNotificationToken:completion:
deregisterWithToken:
migrated to
deregisterWithNotificationToken:completion:
handleNotification:
migrated to
handleNotification:completion:
chatClient:connectionStateChanged:
renamed to
chatClient:connectionStateUpdated:
chatClient:synchronizationStateChanged:
renamed to `chatClient:synchronizationStateUpdated:
chatClient:channelChanged:
migrated to
chatClient:channel:updated:
- chatClient:channel:synchronizationStatusChanged:
chatClient:channel:memberChanged:
renamed to
chatClient:channel:member:updated:
chatClient:channel:messageChanged:
migrated to
chatClient:channel:message:updated:
- chatClientToastSubscribed
: (REMOVED)
- chatClient:toastRegistrationFailedWithError:
(REMOVED)
chatClient:toastReceivedOnChannel:message:
migrated to
chatClient:notificationNewMessageReceivedForChannelSid:messageIndex:
+ chatClient:user:updated:
(ADDED)
+ chatClient:userSubscribed:
(ADDED)
+ chatClient:userUnsubscribed:
(ADDED)
synchronizeWithCompletion:
(REMOVED)
chatClient:channelChanged:
migrated to
chatClient:channel:updated:
chatClient:channel:synchronizationStatusChanged:
renamed to
chatClient:channel:synchronizationStatusUpdated:
chatClient:channel:memberChanged:
renamed to
chatClient:channel:member:updated:
chatClient:channel:messageChanged:
migrated to
chatClient:channel:message:updated:
chatClient:channel:member:userInfo:updated:
migrated to
chatClient:channel:member:user:updated:
+ chatClient:channel:member:userSubscribed:
(ADDED)
+ chatClient:channel:member:userUnsubscribed:
(ADDED)
- userChannelsWithCompletion:
(REMOVED)
+ subscribedChannels
(ADDED)
+ userChannelDescriptorsWithCompletion:
(ADDED)
publicChannelsWithCompletion:
renamed to
publicChannelDescriptorsWithCompletion:
+ TCHChannelStatusUnknown (ADDED)
+ userDescriptorWithCompletion:
(ADDED)
+ subscribedUserWithCompletion:
(ADDED)
+ resultCode
(ADDED)
+ resultText
(ADDED)
+ userDescriptorsForChannel:completion:
+ userDescriptorWithIdentity:completion:
+ subscribedUserWithIdentity:completion:
+ subscribedUsers
+ isSubscribed
(ADDED)
+ unsubscribe
(ADDED)
+ subscribeWithCompletion:
(ADDED)
- setAttributes:completion:
(REMOVED)
- setFriendlyName:completion:
(REMOVED)
handleNotification:
method where the badge count updates. When your application is foregrounded, iOS will not automatically update the springboard badge count on its own so your application must manually update it. If your application receives its badge updates through a mechanism other than Twilio, you can omit this delegate method and handle this event in another way. See
chatClient:notificationUpdatedBadgeCount:
in the SDK docs or
[demo application]
for more information including a sample implementation.
endpoint_id
identifier specified in access tokens is now automatically generated and persisted in the keychain. The following should be observed with this change:
endpoint_id
is no longer a required identifier in your generated access tokens, you may omit it from this build forward
endpoint_id
will be ignored if specified with your access token
endpoint_id
may not persist between runs to the simulator keychain without this
[work-around]
shutdown
of the client. Ensure when you are logging a user fully out of an application that registers for push notifications you call
deregisterWithToken:
with the device's token prior to
shutdown
to prevent messages continuing to be delivered to the device.
+ updateToken
method
+ createdBy
property
+ memberWithIdentity
method
+ getUnconsumedMessagesCountWithCompletion:
+ getMessagesCountWithCompletion:
+ getMembersCountWithCompletion:
- allObjects
+ userChannelsWithCompletion:
+ publicChannelsWithCompletion:
- channelWithId:
- channelWithUniqueName:
+ channelWithSidOrUniqueName:completion:
TCHChannelDescriptorPaginatorCompletion (ADDED) TCHChannelPaginatorCompletion (ADDED) TCHMemberPaginatorCompletion (ADDED) TCHChannelCompletion (ADDED)
TCHChannelDescriptor (ADDED) TCHChannelDescriptorPaginator
TCHChannelPaginator (ADDED)
TCHMemberPaginator (ADDED)
- allObjects
+ membersWithCompletion:
- allObjects
- getMessageWithIndex:
+ getMessageWithIndex:completion:
- messageForConsumptionIndex:
+ messageForConsumptionIndex:completion: