Skip to content

Commit

Permalink
Handled error in case CloudKit method fails
Browse files Browse the repository at this point in the history
  • Loading branch information
Atul M committed Nov 22, 2016
1 parent 853340d commit 4dc6318
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions Settings/Network/BKiCloudSyncHandler.m
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,10 @@ - (void)initSyncHandler{
CKRecordZone *zone = [[CKRecordZone alloc]initWithZoneName:BKiCloudZoneName];
[database saveRecordZone:zone
completionHandler:^(CKRecordZone * _Nullable zone, NSError * _Nullable error) {

if(error){
//Reset shared handler so that init is called again.
sharedHandler = nil;
}
}];
NSPredicate *predicate = [NSPredicate predicateWithValue:YES];
CKQuerySubscription *subscripton = [[CKQuerySubscription alloc]initWithRecordType:@"BKHost" predicate:predicate options:(CKQuerySubscriptionOptionsFiresOnRecordCreation|CKQuerySubscriptionOptionsFiresOnRecordUpdate|CKQuerySubscriptionOptionsFiresOnRecordDeletion)];
Expand All @@ -74,7 +77,10 @@ - (void)initSyncHandler{
subscripton.notificationInfo = info;

[database saveSubscription:subscripton completionHandler:^(CKSubscription * _Nullable subscription, NSError * _Nullable error) {

if(error){
//Reset shared handler so that init is called again.
sharedHandler = nil;
}
}];
}

Expand Down

0 comments on commit 4dc6318

Please sign in to comment.