If you are interested in Mac Catalyst support, please contact support to get hands-on experience with it.
Support for 1.x will cease on April 3, 2024. Please upgrade to the latest version. See: Versioning and Support Lifecycle.
The latest release of the Sync SDK for iOS is version 2.0.2. You may download the latest version of the SDK as an Archive or integrate it as a project dependency with CocoaPods or Swift Package Manager.
To install the SDK using CocoaPods, add the following to your Podfile
, changing MyTarget
to the name of your target:
1use_frameworks!2platform :ios, '13.0'34target 'MyTarget' do5pod 'TwilioSyncClient', '~>2.0'6end
To install the SDK using Swift Package Manager, follow these steps:
https://github.com/twilio/twilio-sync-ios
into the search field in the
Choose Package Repository:
dialog, then click
Next
.
Links are provided to specific patch versions here. We don't recommend using these links unless you have a specific need for a certain patch.
d9969a26757b642b6aee86849e22f9c8cd1c764d2275178dc0816625ac8ab170
on{}Opened
delegate method
4f5da67d89e4e25dca6e3e19f62ef99df33580538772545096e5a59fbef73e38
on{}Opened
delegate methods not properly initialized
27dbf067f48628bb50f1289ea50e1ac08142fdb751df0544d4de91da1fbd6294
2dd01bea43263c616c96ec1caf439f1b0a9e9b5aced3da140c102a112e0d4278
4ef0b8fd195bb9f3c77c29d6560db289e29ebe9525d7ae0b25b0b7962bedac56
818a9d2d005e866db0021b399c4f3ee50f248ac4b5a99f01fbb3ecfddf5ac443
1f2ff3caea120cadfca0c9e50128489861836ab37aa46f411c164db15f6510e7
d287322d484d2baa1562e0e589758e0a7aa63abe1e982c6c9806dbae86286f18
TWSList
,
TWSMap
, and
TWSDocument
.
dateUpdated
for all sync objects.
useProxy
passed to client properties on client creation. Proxy settings are read from the system configuration.
deferCertificateTrustToPlatform
, passed to client properties on client creation.
1401: Unable to establish connection to Twilio Sync service
.
TWSLogLevelSilent
, which is also the new default level. We strongly encourage customers use this logging level for production builds especially if serving European end-users.
onStreamRemoved:eventContext:
, which is now called as expected when a stream is removed. Please use the delegate method
onStream:removedWithEventContext:
for future compatibility.
on*Error
methods for entities will no longer be called when a failure to open occurs. The completion handler for such operations is the best way to check for success or failure on open/creation.
nonnull
could receive nil objects.
Synopsis of enhancements:
flowId
has been deprecated in favor of using the completion blocks already present in the SDK.
remote
(for remotely initiated operations) and
result
(for locally initiated operations) has been transitioned to
TWSEventContext
's
isLocal
property. You will receive a call to the now shared delegate methods with this object where it is applicable. For Lists and Maps, local operations previously provided the delegate call with only the index or key for the item - the full item will now be returned for both local and remote operations.
TWSOpenOptions
has been expanded to allow specifying a TTL during object creation (this property is ignored when opening preexisting objects). The
TWS*Metadata
classes taken as a parameter for some methods on Document, List and Map are optional and can be specified as nil.
Migration tips:
flowID
has been removed globally; most places that previously accepted a flowID
now accept metadata
which can be nil
today if you are not specifying a TTL.
Most delegate methods have changed signature. This is important to note since legacy delegate methods will generally not produce any warnings or errors with this change. The individual remote and local delegate methods have been combined into a single delegate method for operations. Delegates which previously received only an index or key will now receive the full value. Most delegate methods now also provide a TWSEventContext
object which will indicate whether the operation was locally or remotely initiated.
Update squashing:
Individual local operations will continue to return the status of each operation via their completion block but updates sent to the server may be batched for efficiency. This means remote clients may not see every state update performed individually, but will instead see updates with the object's final updated state.
If you require updates to be treated as individual operations for purposes of notifying remote clients, it is recommended you schedule subsequent updates to occur after the completion of each operation.
Specific changes to classes:
TWSConstants
TWSDuration
(NEW)
TWSDurationInfinity
(NEW)
TWSDataMutator
no longer takes a
flowId
parameter
(CHANGED)
TWSOpenOptions
- (TWSOpenOptions *)ttl:(TWSDuration)ttl
(NEW)
- (TWSDuration)ttl
(NEW)
TWSEventContext
(NEW)
isLocal
property which will return true if the operation was initiated by the local client, false if initiated remotely.
TWSDocument
-setTtl:completion:
method
flowID
references, added
TWSDocumentMetadata
for specifying initial TTL.
Old Method | New Method |
---|---|
-setData:flowId:completion: | -setData:metadata:completion: |
-mutateDataWith:flowId:completion: | -mutateDataWith:metadata:completion: |
-removeDocumentWithFlowId:completion: | -removeDocumentWithCompletion: |
-setTtl:completion: (NEW) |
TWSDocumentDelegate
flowID
, added
TWSEventContext
for methods called as a result of both local and remote operations.
Old Method | New Method |
---|---|
-onDocumentResultOpened: | -onDocumentOpened: |
-onDocument:resultRemovedForFlowID: -onDocumentRemoteRemoved: | -onDocumentRemoved:eventContext: |
-onDocumentResultUpdated:forFlowID: -onDocumentRemoteUpdated: | -onDocument:updated:eventContext: |
-onDocument:resultErrorOccurred:forFlowID: | -onDocument:errorOccurred: |
TWSDocumentMetadata
TWSList
-setTtl:completion:
method
-setTtl:forItemAtIndex:completion:
method
-setItemWithData:metadata:completion:
now accepts a
TWSListItemCompletion
block instead of
TWSCompletion
flowID
references, added
TWSListItemMetadata
for specifying TTL for items on add and modification.
Old Method | New Method |
---|---|
-addItemWithData:flowId:completion: | -addItemWithData:metadata:completion: |
-getItemAtIndex:flowId:completion: | -getItemAtIndex:completion: |
-setItemWithData:flowId:completion: | -setItemWithData:metadata:completion: |
-mutateItemAtIndex:mutator:flowId:completion: | -mutateItemAtIndex:mutator:metadata:completion: |
-removeItemAtIndex:flowId:completion: | -removeItemAtIndex:completion: |
-removeListWithFlowId:completion: | -removeListWithCompletion: |
-setTtl:completion: (NEW) | |
-setTtl:forItemAtIndex:completion: (NEW) |
TWSListDelegate
flowID
, added
TWSEventContext
for methods called as a result of both local and remote operations.
Old Method | New Method |
---|---|
-onListResultOpened: | -onListOpened: |
-onList:resultItemAddedAtIndex:forFlowID: -onList:remoteItemAdded: | -onList:itemAdded:eventContext: |
-onList:resultItemRemovedAtIndex:forFlowID: -onList:remoteItemRemoved: | -onList:itemRemoved:eventContext: |
-onList:resultItemUpdatedAtIndex:forFlowID: -onList:remoteItemUpdated: | -onList:itemUpdated:eventContext: |
-onList:resultCollectionRemovedForFlowID: -onListRemoteCollectionRemoved: | -onList:collecionRemovedWithEventContext: |
-onList:resultErrorOccurred:forFlowID: | -onList:errorOccurred: |
TWSListItemMetadata
TWSMap
-setTtl:completion:
method
-setTtl:forItemWithKey:completion:
method
-setItemWithKey:data:metadata:completion:
now accepts a
TWSMapItemCompletion
block instead of
TWSCompletion
flowID
references, added
TWSMapItemMetadata
for specifying TTL for items on set and modification.
Old Method | New Method |
---|---|
-getItemWithKey:flowId:completion: | -getItemWithKey:completion: |
-setItemWithKey:data:flowId:completion: | -setItemWithKey:data:metadata:completion: |
-mutateItemWithKey:mutator:flowId:completion: | -mutateItemWithKey:mutator:metadata:completion: |
-removeItemWithKey:flowId:completion: | -removeItemWithKey:completion: |
-removeMapWithFlowId:completion: | -removeMapWithCompletion: |
-setTtl:completion: (NEW) | |
-setTtl:forItemWithKey:completion: (NEW) |
TWSMapDelegate
flowID
, added
TWSEventContext
for methods called as a result of both local and remote operations.
Old Method | New Method |
---|---|
-onMapResultOpened: | -onMapOpened: |
-onMap:resultItemSetWithKey:forFlowID: (for adds) -onMap:remoteItemAdded: | -onMap:itemAdded:eventContext: |
-onMap:resultItemSetWithKey:forFlowID: (for updates) -onMap:remoteItemUpdated: | -onMap:itemUpdated:eventContext: |
-onMap:resultItemRemovedWithKey:forFlowID: -onMap:remoteItemRemovedWithKey: | -onMap:itemRemovedWithKey:eventContext: |
-onMap:resultErrorOccurred:forFlowID: | -onMap:errorOccurred: |
-onMap:resultCollectionRemovedForFlowID: -onMapRemoteCollectionRemoved: | -onMap:collecionRemovedWithEventContext: |
TWSMapItemMetadata
TWSStream
-setTtl:completion:
method
flowID
references.
Old Method | New Method |
---|---|
-publishMessageWithData:flowId:completion: | -publishMessageWithData:completion: |
-removeStreamWithFlowId:completion: | -removeStreamWithCompletion: |
-setTtl:completion: (NEW) |
TWSStreamDelegate
flowID
, added
TWSEventContext
for methods called as a result of both local and remote operations.
Old Method | New Method |
---|---|
-onStreamResultOpened: | -onStreamOpened: |
-onStream:resultMessagePublished:forFlowID: -onStream:remoteMessagePublished: | -onStream:messagePublished:eventContext: |
-onStream:resultRemovedForFlowID: -onStreamRemoteRemoved: | -onStreamRemoved:eventContext: |
-onStream:resultErrorOccurred:forFlowID: | -onStream:errorOccurred: |
updateToken:completion:
once again give feedback if the provided token is expired or otherwise invalid.
syncClientWithToken:properties:delegate:completion:
's completion method.
tokenUpdate:
now provides feedback via a completion method of success or failure.
openStreamWithOptions:delegate:completion:
method on TwilioSyncClient.
TWSStream
and
TWSStreamMessage
objects.
TWSStreamDelegate
delegate.
onDocument:remoteErrorOccurred:
delegate method removed.
onDocument:resultErrorOccurred:
is no longer flagged as nullable, it will always be presented.
onList:remoteErrorOccurred:
delegate method removed.
onList:remoteItemRemoved:
instead of index.
onList:resultErrorOccurred:
is no longer flagged as nullable, it will always be presented.
onMap:remoteErrorOccurred:
delegate method removed.
onMap:remoteItemRemoved:
instead of key.
onMap:resultErrorOccurred:
is no longer flagged as nullable, it will always be presented.
synchronizationStrategy:
declaration, allows specifying of synchronization strategy.
TWSTwilioClientCompletion
as a parameter to client creation. Clients are no longer created as immediate returns, instead the completion block is called when the client is available and ready for use.
updateToken
accepts a completion block now to indicate the success or failure of the token update operation.
TWSSynchronizationStrategy
(with values
TWSSynchronizationStrategyDefault
and
TWSSynchronizationStrategyAggressive
) to
TWSOpenOptions
.
set
delegate method but instead distinct
added
and
updated
delegate methods to convey which operation occurred.
TWSY
for easier evaluation of logs.
uniqueName
accessor on
TWSOpenOptions
- the set value will be available via the
sidOrUniqueName
accessor.
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
[workaround]
.
- (void)syncClient:(nonnull TwilioSyncClient *)client errorReceived:(nonnull TWSError *)error
; will be called in case of client failures, for example when using an invalid access token.