Sync SDK for iOS

Latest release


The latest major release of the Sync SDK for iOS is v0.7. You may download the latest version of the SDK as a tarfile or wire a dependency with CocoaPods.

source 'https://github.com/twilio/cocoapod-specs'

target 'TicTacTwilio' do
   pod 'TwilioSyncClient', '~>0.7.2'
end

Version History & Changelog


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 of a release.


Sync SDK for iOS v0.7.2 (March 2, 2018)

Changes

  • 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.
  • Resolved issue where delegate method parameters marked as nonnull could receive nil objects.
  • Resolved issue where remote update delegate calls may not be received.

Sync SDK for iOS v0.7.1 (February 7, 2018)

Changes

  • Updated internal certificate store for upcoming certificate authority changes.

Sync SDK for iOS v0.7.0 (January 17, 2018)

Changes

Synopsis of enhancements:

  • flowId has been deprecated in favor of using the completion blocks already present in the SDK.
  • The distinction between 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.
  • Documents, Lists (and their items), Maps (and their items) and Streams may now all have an optional max time to live specified. This number is expressed in seconds and is relative to when the TTL is set. After the TTL expires, the object will be destroyed on the backend in the near future. 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
    • typedef TWSDuration (NEW)
    • constant TWSDurationInfinity (NEW)
    • block TWSDataMutator no longer takes a flowId parameter (CHANGED)
  • TWSOpenOptions
    • - (TWSOpenOptions *)ttl:(TWSDuration)ttl (NEW)
    • - (TWSDuration)ttl (NEW)
  • TWSEventContext (NEW)
    • Added to provide context to your delegate about the operation performed. Today, this includes an isLocal property which will return true if the operation was initiated by the local client, false if initiated remotely.
  • TWSDocument
    • Added -setTtl:completion: method
    • Removed 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
    • Updated delegate methods to remove 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
    • Added to optionally provide initial TTL on Document creation.
  • TWSList
    • Added -setTtl:completion: method
    • Added -setTtl:forItemAtIndex:completion: method
    • -setItemWithData:metadata:completion: now accepts a TWSListItemCompletion block instead of TWSCompletion
    • Removed 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
    • Updated delegate methods to remove 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
    • Added to optionally provide initial TTL on List Item creation or modification.
  • TWSMap
    • Added -setTtl:completion: method
    • Added -setTtl:forItemWithKey:completion: method
    • -setItemWithKey:data:metadata:completion: now accepts a TWSMapItemCompletion block instead of TWSCompletion
    • Removed 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
    • Updated delegate methods to remove 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
    • Added to optionally provide initial TTL on Map Item creation or modification.
  • TWSStream
    • Added -setTtl:completion: method
    • Removed flowID references.
Old Method New Method
-publishMessageWithData:flowId:completion: -publishMessageWithData:completion:
-removeStreamWithFlowId:completion: -removeStreamWithCompletion:
-setTtl:completion: (NEW)
  • TWSStreamDelegate
    • Updated delegate methods to remove 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:

Sync SDK for iOS v0.6.2 (February 7, 2018)

Changes

  • Updated internal certificate store for upcoming certificate authority changes.

Sync SDK for iOS v0.6.1 (November 22, 2017)

Changes

  • Both Sync client creation and updateToken:completion: once again give feedback if the provided token is expired or otherwise invalid.
  • Re-connection to the Sync server will occur faster when bringing the application to the foreground or the device's network connection recovering while in the application.
  • Improved completion handler execution if network connection terminates while an operation is in progress.

Sync SDK for iOS v0.6.0 (September 14, 2017)

Changes

  • With the addition of support for iOS 11, we are deprecating support for iOS 8 in Sync iOS 0.6.x.
  • Client creation is now asynchronous, with successful client creations being delivered through the TwilioSyncClient syncClientWithToken:properties:delegate:completion:'s completion method.
  • tokenUpdate: now provides feedback via a completion method of success or failure.
  • Added Steams:
    • New openStreamWithOptions:delegate:completion: method on TwilioSyncClient
    • New TWSStream and TWSStreamMessage objects
    • New TWSStreamDelegate delegate
  • Document Changes:
    • Unused onDocument:remoteErrorOccurred: delegate method removed
    • Redundant data parameter removed from delegate calls, data property is available on document which is passed to delegate method already
    • document property of onDocument:resultErrorOccurred: is no longer flagged as nullable, it will always be presented
  • List Changes:
    • Unused onList:remoteErrorOccurred: delegate method removed
    • Redundant item index parameter removed from delegate calls, index property is available on item which is passed to delegate method already
    • Deleted list item is now passed to onList:remoteItemRemoved: instead of index
    • list property of onList:resultErrorOccurred: is no longer flagged as nullable, it will always be presented
  • Map Changes:
    • Unused onMap:remoteErrorOccurred: delegate method removed
    • Redundant item key parameter removed from delegate calls, key property is available on item which is passed to delegate method already
    • Deleted map item is now passed to onMap:remoteItemRemoved: instead of key
    • map property of onMap:resultErrorOccurred: is no longer flagged as nullable, it will always be presented
  • OpenOptions Changes:
    • Added synchronizationStrategy: declaration, allows specifying of synchronization strategy.
  • Completion blocks now include nullability hints for return values and parameters

Sync SDK for iOS v0.5.0 (June 21, 2017)

Changes

  • Introduced 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.
  • Added optional TWSSynchronizationStrategy (with values TWSSynchronizationStrategyDefault and TWSSynchronizationStrategyAggressive) to TWSOpenOptions.
  • Remotely changed items within Maps no longer are notified via a single set delegate method but instead distinct added and updated delegate methods to convey which operation occurred.
  • Sync SDK log output is now prefixed with TWSY for easier evaluation of logs
  • Deprecation of distinct uniqueName accessor on TWSOpenOptions - the set value will be available via the sidOrUniqueName accessor

Sync SDK for iOS v0.2.0 (March 16, 2017)

Changes

  • Resolved potential incompatibility with other Twilio SDKs in the same project
  • Updated framework signing for AppStore compatibility
  • The 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
    • When running in the iOS simulator only, the automatically generated endpoint_id may not persist between runs to the simulator keychain without this [work-around]
  • If a client is initially created with an invalid access token, creation will fail and nil will be returned for the client instance
  • Added new error callback to SyncClient: - (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.
  • Security enhancements

Need some help?

We all do sometimes; code is hard. Get help now from our support team, or lean on the wisdom of the crowd browsing the Twilio tag on Stack Overflow.