This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Add Framework: AudioToolbox.framework | |
#import <AudioToolbox/AudioToolbox.h> | |
//Obj-C: | |
AudioServicesPlayAlertSound(kSystemSoundID_Vibrate); | |
AudioServicesPlaySystemSound(kSystemSoundID_Vibrate); | |
//Swift: | |
AudioServicesPlayAlertSound(UInt32(kSystemSoundID_Vibrate)); | |
AudioServicesPlaySystemSound(UInt32(kSystemSoundID_Vibrate)) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Objective-C | |
CKModifyRecordsOperation *modifyRecordsOperation = [[CKModifyRecordsOperation alloc] initWithRecordsToSave:records recordIDsToDelete:nil]; | |
modifyRecordsOperation.atomic=NO; | |
modifyRecordsOperation.perRecordCompletionBlock = ^(CKRecord *record, NSError *error) { | |
//Swift 4.0 | |
let modifyRecordsOperation = CKModifyRecordsOperation(recordsToSave: records, recordIDsToDelete: nil) | |
modifyRecordsOperation.isAtomic = false | |
modifyRecordsOperation.perRecordCompletionBlock = {(_ record: CKRecord, _ error: Error?) -> Void in } as? Void) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CKModifyRecordsOperation *modifyRecordsOperation = [[CKModifyRecordsOperation alloc] initWithRecordsToSave:records recordIDsToDelete:nil]; | |
modifyRecordsOperation.atomic=NO; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { | |
//after changes | |
static NSString *CellIdentifier = @"Cella"; // change 1 - not the same with storyboard prototype cell | |
UITableViewCell *cell = (UITableViewCell *)[self.myTableView dequeueReusableCellWithIdentifier:CellIdentifier]; | |
float screenW1 = [UIScreen mainScreen].bounds.size.width; | |
UIImage *cellImage; | |
UIButton *cellImageView; | |
UILabel *firstLabel, *secondLabel; | |
NSString *pathCircle; | |
if(!cell) {// change 2 - use initWithStyle reuseIdentifier - drawing, create frames just here |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (IBAction)startSync:(id)sender { | |
NSLog(@"startSync"); | |
AppDelegate *appdelegate =(AppDelegate *)[UIApplication sharedApplication].delegate; | |
[appdelegate sync]; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma mark - QSCoreDataChangeManagerDelegate | |
- (void)changeManagerRequestsContextSave:(QSCoreDataChangeManager *)changeManager completion:(void (^)(NSError *))completion | |
{ | |
if (debug==1) { | |
NSLog(@"Running %@ '%@'", self.class, NSStringFromSelector(_cmd)); | |
} | |
__block NSError *error = nil; | |
[self.managedObjectContext performBlockAndWait:^{ | |
[self.managedObjectContext save:&error]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma mark - ICLOUD | |
- (BOOL)iCloudAccountIsSignedIn { | |
if (debug==1) { | |
NSLog(@"Running %@ '%@'", self.class, NSStringFromSelector(_cmd)); | |
} | |
id token = [[NSFileManager defaultManager] ubiquityIdentityToken]; | |
if (token) { | |
NSLog(@"** iCloud is SIGNED IN with token '%@' **", token); | |
return YES; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma mark - SYNC | |
- (QSCloudKitSynchronizer *)synchronizer | |
{ | |
if ([self iCloudEnabledByUser] && [self iCloudAccountIsSignedIn]) { | |
NSLog(@"** iCloud available SYNCHRONIZER! **"); | |
if (!_synchronizer) { | |
_synchronizer = [QSCloudKitSynchronizer cloudKitSynchronizerWithContainerName:@"iCloud.com.SyncKitTest" managedObjectContext:self.managedObjectContext changeManagerDelegate:self]; | |
} | |
}else{ | |
NSLog(@"** iCloud not available **"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma mark - Core Data stack | |
@synthesize managedObjectContext = _managedObjectContext; | |
@synthesize managedObjectModel = _managedObjectModel; | |
@synthesize persistentStoreCoordinator = _persistentStoreCoordinator; | |
- (NSURL *)applicationDocumentsDirectory { | |
// The directory the application uses to store the Core Data store file. This code uses a directory named "com.colourbox.cloudkittest.prueba" in the application's documents directory. | |
return [[[NSFileManager defaultManager] URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask] lastObject]; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@IBAction func returned(from segue: UIStoryboardSegue) { | |
if (segue.identifier! == "UnwindFromSecondView") { | |
self.view.backgroundColor! = UIColor.orange | |
} | |
} |
NewerOlder