AgileBits / AgileCloudKit
- суббота, 7 мая 2016 г. в 03:11:50
Objective-C
AgileCloudKit is our CloudKit JS implementation of the CloudKit framework. It is used in 1Password for Mac.
AgileCloudKit is a drop-in replacement for CloudKit framework for use in non-Mac App Store apps. It uses CloudKitJS and CloudKit Web Services to communicate with iCloud.
AgileCloudKit is a proven technology currently in use by 1Password when purchased from the AgileBits Store. 1Password uses AgileCloudKit to sync password data seamlessly with the Mac App Store and iOS App Store versions which use Apple’s native CloudKit framework.
See the license file for AgileCloudKit’s distribution license
See the file named Using AgileCloudKit for information on how to set up AgileCloudKit in your application.
AgileCloudKit is not yet a 100% complete implementation of CloudKit. There are a few classes that are not yet implemented. Of note are:
- CKFetchSubscriptionsOperation
- CKDiscoverAllContactsOperation
- CKDiscoverUserInfosOperation
- CKFetchWebAuthTokenOperation
- CKLocationSortDescriptor
- CKModifyBadgeOperation
- CKQuery: this doesn’t have a direct equivalent in CloudKit JS. CloudKitJS uses filters: JSON dictionaries with query parameters. CKQuery uses NSPredicate which works quite differently from JSON query dictionaries. AgileCloudKit contains the CKFilter class to provide query functionality but due to the different nature of the NSPredicates and CKFilters, making a direct implementation of CKOperations that use the CKQuery class would be difficult.
- CKQueryOperation
- CKQueryNotification
Some classes do not contain every method as their native CloudKit counterparts, particularly those methods that have been added in OS X 10.11.
AgileCloudKit communicates with iCloud using a mix of JavaScript calls from a JavaScript context and the REST API. The long term goal is to move toward using the REST API. This has a number of advantages, one of which is eliminating the need for a Javascript context that runs on the main thread.
Two apps are bundled with the framework. The CloudZone app uses Apple's CloudKit framework, and the AgileCloudZone uses the AgileCloudKit framework. The sample apps may not contain all functionality of the framework. They are there to act as a playground to test different aspects of the framework as needed.
To use the CloudZone apps you will need to set up a test container in CloudKit Dashboard, and set the appropriate App IDs and credentials in the two apps. The CloudZone app requires the iCloud CloudKit capabilities enabled and must have Mac App Store code signing set in order to use native CloudKit. The AgileCloudZone app does not need to be signed as it uses CloudKitJS, but does need the appropriate CloudKitJS credentials and the URL type set in its Info.plist. There are placeholder values in the project that can be modified.
The CloudZone apps are minimal and have a few rough edges, but have a few features: