Slide 1

Slide 1 text

These are confidential sessions—please refrain from streaming, blogging, or taking pictures Session 224 Using iCloud with NSDocument Kevin Perry Software Engineer, Cocoa Frameworks

Slide 2

Slide 2 text

No content

Slide 3

Slide 3 text

Cloud

Slide 4

Slide 4 text

No content

Slide 5

Slide 5 text

No content

Slide 6

Slide 6 text

NSDocument

Slide 7

Slide 7 text

NSDocument File Coordination

Slide 8

Slide 8 text

NSDocument File Coordination Document Management

Slide 9

Slide 9 text

NSDocument File Coordination Document Management Conflict Resolution

Slide 10

Slide 10 text

NSDocument File Coordination Document Management Conflict Resolution Alerts

Slide 11

Slide 11 text

iCloud Adoption Mechanics Best Practices

Slide 12

Slide 12 text

Provisioning Profile

Slide 13

Slide 13 text

Provisioning Profile •Identifies your development team

Slide 14

Slide 14 text

Provisioning Profile •Identifies your development team •Defines the devices your App can run on

Slide 15

Slide 15 text

Provisioning Profile •Identifies your development team •Defines the devices your App can run on •Grants iCloud support

Slide 16

Slide 16 text

Provisioning Profile •Identifies your development team •Defines the devices your App can run on •Grants iCloud support •Defines your Ubiquity container

Slide 17

Slide 17 text

Provisioning Profile •Identifies your development team •Defines the devices your App can run on •Grants iCloud support •Defines your Ubiquity container •Provisioning Portal

Slide 18

Slide 18 text

Get Entitled

Slide 19

Slide 19 text

Demo

Slide 20

Slide 20 text

iCloud Adoption Mechanics Best Practices

Slide 21

Slide 21 text

Auto Save Adoption Responsiveness Serialization Versions iCloud Adoption Mechanics Best Practices

Slide 22

Slide 22 text

Auto Save iCloud Adoption Responsiveness Serialization Versions Adoption Mechanics Best Practices

Slide 23

Slide 23 text

Why Adopt Auto Save?

Slide 24

Slide 24 text

Why Adopt Auto Save? •Modern document workflow

Slide 25

Slide 25 text

Why Adopt Auto Save? •Modern document workflow •Versions

Slide 26

Slide 26 text

Why Adopt Auto Save? •Modern document workflow •Versions •Automatic Termination and Resume

Slide 27

Slide 27 text

Why Adopt Auto Save? •Modern document workflow •Versions •Automatic Termination and Resume •iCloud

Slide 28

Slide 28 text

Why Adopt Auto Save? •Modern document workflow •Versions •Automatic Termination and Resume •iCloud •File Coordination

Slide 29

Slide 29 text

Enable Auto Save

Slide 30

Slide 30 text

Enable Auto Save + (BOOL)autosavesInPlace { ! return YES; }

Slide 31

Slide 31 text

Enable Auto Save NSAutosaveElsewhereOperation NSAutosaveInPlaceOperation + (BOOL)autosavesInPlace { ! return YES; }

Slide 32

Slide 32 text

No content

Slide 33

Slide 33 text

NSSaveOperation User Initiated Save In Place Save Elsewhere Save Elsewhere & Redirect “Save” — NSSaveOperation “Export” — NSSaveToOperation “Save As” — NSSaveAsOperation

Slide 34

Slide 34 text

NSSaveOperation My Document User Initiated Save In Place Save Elsewhere Save Elsewhere & Redirect “Save” — NSSaveOperation “Export” — NSSaveToOperation “Save As” — NSSaveAsOperation

Slide 35

Slide 35 text

NSSaveOperation My Document My Document User Initiated Save In Place Save Elsewhere Save Elsewhere & Redirect “Save” — NSSaveOperation “Export” — NSSaveToOperation “Save As” — NSSaveAsOperation

Slide 36

Slide 36 text

NSSaveToOperation My Document User Initiated Save In Place Save Elsewhere Save Elsewhere & Redirect “Save” — NSSaveOperation “Export” — NSSaveToOperation “Save As” — NSSaveAsOperation

Slide 37

Slide 37 text

NSSaveToOperation My Document Another Document User Initiated Save In Place Save Elsewhere Save Elsewhere & Redirect “Save” — NSSaveOperation “Export” — NSSaveToOperation “Save As” — NSSaveAsOperation

Slide 38

Slide 38 text

My Document NSSaveAsOperation User Initiated Save In Place Save Elsewhere Save Elsewhere & Redirect “Save” — NSSaveOperation “Export” — NSSaveToOperation “Save As” — NSSaveAsOperation

Slide 39

Slide 39 text

My Document NSSaveAsOperation My Document 2 User Initiated Save In Place Save Elsewhere Save Elsewhere & Redirect “Save” — NSSaveOperation “Export” — NSSaveToOperation “Save As” — NSSaveAsOperation

Slide 40

Slide 40 text

My Document NSSaveAsOperation My Document 2 User Initiated Save In Place Save Elsewhere Save Elsewhere & Redirect “Save” — NSSaveOperation “Export” — NSSaveToOperation “Save As” — NSSaveAsOperation

Slide 41

Slide 41 text

User Initiated Automatic Save In Place Save Elsewhere Save Elsewhere & Redirect “Save” — NSSaveOperation NSAutosaveInPlaceOperation “Export” — NSSaveToOperation NSAutosaveElsewhereOperation “Save As” — NSSaveAsOperation

Slide 42

Slide 42 text

User Initiated Automatic Save In Place Save Elsewhere Save Elsewhere & Redirect “Save” — NSSaveOperation NSAutosaveInPlaceOperation “Export” — NSSaveToOperation NSAutosaveElsewhereOperation “Save As” — NSSaveAsOperation NSAutosaveElsewhereOperation

Slide 43

Slide 43 text

User Initiated Automatic Save In Place Save Elsewhere Save Elsewhere & Redirect “Save” — NSSaveOperation NSAutosaveInPlaceOperation “Export” — NSSaveToOperation NSAutosaveElsewhereOperation “Save As” — NSSaveAsOperation NSAutosaveElsewhereOperation Untitled

Slide 44

Slide 44 text

User Initiated Automatic Save In Place Save Elsewhere Save Elsewhere & Redirect “Save” — NSSaveOperation NSAutosaveInPlaceOperation “Export” — NSSaveToOperation NSAutosaveElsewhereOperation “Save As” — NSSaveAsOperation NSAutosaveElsewhereOperation Autosaved Document Untitled

Slide 45

Slide 45 text

User Initiated Automatic Save In Place Save Elsewhere Save Elsewhere & Redirect “Save” — NSSaveOperation NSAutosaveInPlaceOperation “Export” — NSSaveToOperation NSAutosaveElsewhereOperation “Save As” — NSSaveAsOperation NSAutosaveElsewhereOperation Autosaved Document My Document

Slide 46

Slide 46 text

User Initiated Automatic Save In Place Save Elsewhere Save Elsewhere & Redirect “Save” — NSSaveOperation NSAutosaveInPlaceOperation “Export” — NSSaveToOperation NSAutosaveElsewhereOperation “Save As” — NSSaveAsOperation NSAutosaveElsewhereOperation My Document

Slide 47

Slide 47 text

User Initiated Automatic Save In Place Save Elsewhere Save Elsewhere & Redirect “Save” — NSSaveOperation NSAutosaveInPlaceOperation “Export” — NSSaveToOperation NSAutosaveElsewhereOperation “Save As” — NSSaveAsOperation NSAutosaveInPlaceOperation My Document

Slide 48

Slide 48 text

User Initiated Automatic Save In Place Save Elsewhere Save Elsewhere & Redirect “Save” — NSSaveOperation NSAutosaveInPlaceOperation “Export” — NSSaveToOperation NSAutosaveElsewhereOperation “Save As” — NSSaveAsOperation NSAutosaveInPlaceOperation My Document My Document

Slide 49

Slide 49 text

Demo

Slide 50

Slide 50 text

Auto Save iCloud Adoption Responsiveness Serialization Versions Adoption Mechanics Best Practices

Slide 51

Slide 51 text

Auto Save Responsiveness "Cancellable"  —  matches  spelling  used   in  code  Do  not  correct

Slide 52

Slide 52 text

Auto Save Responsiveness •Asynchronous saving "Cancellable"  —  matches  spelling  used   in  code  Do  not  correct

Slide 53

Slide 53 text

Auto Save Responsiveness •Asynchronous saving •Cancellable autosaves "Cancellable"  —  matches  spelling  used   in  code  Do  not  correct

Slide 54

Slide 54 text

Auto Save Responsiveness •Asynchronous saving •Cancellable autosaves •See “Auto Save and Versions in Mac OS X 10.7 Lion” "Cancellable"  —  matches  spelling  used   in  code  Do  not  correct

Slide 55

Slide 55 text

Auto Save Responsiveness •Asynchronous saving •Cancellable autosaves •See “Auto Save and Versions in Mac OS X 10.7 Lion” ■ developer.apple.com/videos "Cancellable"  —  matches  spelling  used   in  code  Do  not  correct

Slide 56

Slide 56 text

Auto Save iCloud Adoption Responsiveness Serialization Versions Adoption Mechanics Best Practices

Slide 57

Slide 57 text

Serialized Resources

Slide 58

Slide 58 text

Serialized Resources User Activities

Slide 59

Slide 59 text

Serialized Resources User Activities File Access

Slide 60

Slide 60 text

Serialized Resources User Activities

Slide 61

Slide 61 text

Serialized Resources Save Revert Duplicate Print User Activities

Slide 62

Slide 62 text

Serialized Resources Save Revert Duplicate Print User Activities Move Rename iCloud conflict resolution

Slide 63

Slide 63 text

Serializing User Activity

Slide 64

Slide 64 text

Serializing User Activity Show UI

Slide 65

Slide 65 text

Serializing User Activity Show UI Perform

Slide 66

Slide 66 text

Serializing User Activity Show UI Perform Present Errors

Slide 67

Slide 67 text

Serializing User Activity Show UI Perform Present Errors Recover

Slide 68

Slide 68 text

Serializing User Activity Print Activity Show UI Perform Present Errors Recover

Slide 69

Slide 69 text

Serializing User Activity Print Activity Show UI Perform Present Errors Recover Activity Show UI Perform Present Errors Recover

Slide 70

Slide 70 text

Serializing User Activity Print Conflict Resolution Activity Show UI Perform Present Errors Recover Activity Show UI Perform Present Errors Recover

Slide 71

Slide 71 text

Serializing User Activity Print Conflict Resolution Activity Show UI Perform Present Errors Recover Activity Show UI Perform Present Errors Recover

Slide 72

Slide 72 text

Serializing User Activity Print Conflict Resolution -performActivityWithSynchronousWaiting:usingBlock: Activity Show UI Perform Present Errors Recover Activity Show UI Perform Present Errors Recover

Slide 73

Slide 73 text

-performActivity… -performActivity… Serializing User Activity Print Conflict Resolution -performActivityWithSynchronousWaiting:usingBlock: Activity Show UI Perform Present Errors Recover Activity Show UI Perform Present Errors Recover

Slide 74

Slide 74 text

-performActivity… -performActivity… Serializing User Activity Print Conflict Resolution -performActivityWithSynchronousWaiting:usingBlock: Completion Handler -performActivity… Activity Show UI Perform Present Errors Recover Activity Show UI Perform Present Errors Recover

Slide 75

Slide 75 text

-performActivity… -performActivity… Serializing User Activity Print Conflict Resolution -performActivityWithSynchronousWaiting:usingBlock: Completion Handler -performActivity… Activity Show UI Perform Present Errors Recover Activity Show UI Perform Present Errors Recover

Slide 76

Slide 76 text

-performActivity… -performActivity… Serializing User Activity Print Conflict Resolution -performActivityWithSynchronousWaiting:usingBlock: -performActivity… Activity Show UI Perform Present Errors Recover Activity Show UI Perform Present Errors Recover

Slide 77

Slide 77 text

-performActivity… -performActivity… -performActivity… -performActivity… Serializing User Activity Print Conflict Resolution -performActivityWithSynchronousWaiting:usingBlock: Activity Show UI Perform Present Errors Recover

Slide 78

Slide 78 text

-performActivity… -performActivity… -performActivity… -performActivity… Serializing User Activity Print Conflict Resolution -performActivityWithSynchronousWaiting:usingBlock: Activity Show UI Perform Present Errors Recover

Slide 79

Slide 79 text

Demo

Slide 80

Slide 80 text

Serialized Resources File Access URL Modification date On-disk contents Edit state

Slide 81

Slide 81 text

File Access For QC: Colon is part of code—leave in

Slide 82

Slide 82 text

File Access •Two types For QC: Colon is part of code—leave in

Slide 83

Slide 83 text

File Access •Two types ■ Synchronous For QC: Colon is part of code—leave in

Slide 84

Slide 84 text

File Access •Two types ■ Synchronous ■ Blocks main thread For QC: Colon is part of code—leave in

Slide 85

Slide 85 text

File Access •Two types ■ Synchronous ■ Blocks main thread ■ Invoked synchronously For QC: Colon is part of code—leave in

Slide 86

Slide 86 text

File Access •Two types ■ Synchronous ■ Blocks main thread ■ Invoked synchronously ■ File access completes on return For QC: Colon is part of code—leave in

Slide 87

Slide 87 text

File Access •Two types ■ Synchronous ■ Blocks main thread ■ Invoked synchronously ■ File access completes on return ■ Asynchronous For QC: Colon is part of code—leave in

Slide 88

Slide 88 text

File Access •Two types ■ Synchronous ■ Blocks main thread ■ Invoked synchronously ■ File access completes on return ■ Asynchronous ■ Enqueues block, return immediately For QC: Colon is part of code—leave in

Slide 89

Slide 89 text

File Access •Two types ■ Synchronous ■ Blocks main thread ■ Invoked synchronously ■ File access completes on return ■ Asynchronous ■ Enqueues block, return immediately ■ Required to work safely with document on non-main thread For QC: Colon is part of code—leave in

Slide 90

Slide 90 text

File Access •Two types ■ Synchronous ■ Blocks main thread ■ Invoked synchronously ■ File access completes on return ■ Asynchronous ■ Enqueues block, return immediately ■ Required to work safely with document on non-main thread ■ Resume on main thread using -continueAsynchronousWorkOnMainThreadUsingBlock: For QC: Colon is part of code—leave in

Slide 91

Slide 91 text

Serialization

Slide 92

Slide 92 text

Serialization •Debugging ■ Hangs ■ Blocks never executing

Slide 93

Slide 93 text

Serialization •Debugging ■ Hangs ■ Blocks never executing •_NSDocumentSerializationInfo()

Slide 94

Slide 94 text

(lldb) bt ... -[NSDocument performSynchronousFileAccessUsingBlock:] -[NSDocument _checkAutosavingThenContinue:] ...

Slide 95

Slide 95 text

(lldb) bt ... -[NSDocument performSynchronousFileAccessUsingBlock:] -[NSDocument _checkAutosavingThenContinue:] ... (lldb) po _NSDocumentSerializationInfo()

Slide 96

Slide 96 text

(lldb) bt ... -[NSDocument performSynchronousFileAccessUsingBlock:] -[NSDocument _checkAutosavingThenContinue:] ... (lldb) po _NSDocumentSerializationInfo() Pending serialization requests (3 total) [0] FILE ACCESS: Document: "Untitled.sketch2" -- State: ACTIVE ! 1 -[NSDocument performAsynchronousFileAccessUsingBlock:] ! 2 -[SKTDocument doSomethingWithFile] ... [1] FILE ACCESS: Document: "Untitled.sketch2" -- State: WAITING ! 1 -[NSDocument performAsynchronousFileAccessUsingBlock:] ! 2 -[NSDocument autosaveWithImplicitCancellability:completionHandler:] ! ... [2] FILE ACCESS: Document: "Untitled.sketch2" -- State: WAITING ! 1 -[NSDocument performSynchronousFileAccessUsingBlock:] 2 -[NSDocument _checkAutosavingThenContinue:] ...!

Slide 97

Slide 97 text

(lldb) bt ... -[NSDocument performSynchronousFileAccessUsingBlock:] -[NSDocument _checkAutosavingThenContinue:] ... (lldb) po _NSDocumentSerializationInfo() Pending serialization requests (3 total) [0] FILE ACCESS: Document: "Untitled.sketch2" -- State: ACTIVE ! 1 -[NSDocument performAsynchronousFileAccessUsingBlock:] ! 2 -[SKTDocument doSomethingWithFile] ... [1] FILE ACCESS: Document: "Untitled.sketch2" -- State: WAITING ! 1 -[NSDocument performAsynchronousFileAccessUsingBlock:] ! 2 -[NSDocument autosaveWithImplicitCancellability:completionHandler:] ! ... [2] FILE ACCESS: Document: "Untitled.sketch2" -- State: WAITING ! 1 -[NSDocument performSynchronousFileAccessUsingBlock:] 2 -[NSDocument _checkAutosavingThenContinue:] ...!

Slide 98

Slide 98 text

(lldb) bt ... -[NSDocument performSynchronousFileAccessUsingBlock:] -[NSDocument _checkAutosavingThenContinue:] ... (lldb) po _NSDocumentSerializationInfo() Pending serialization requests (3 total) [0] FILE ACCESS: Document: "Untitled.sketch2" -- State: ACTIVE ! 1 -[NSDocument performAsynchronousFileAccessUsingBlock:] ! 2 -[SKTDocument doSomethingWithFile] ... [1] FILE ACCESS: Document: "Untitled.sketch2" -- State: WAITING ! 1 -[NSDocument performAsynchronousFileAccessUsingBlock:] ! 2 -[NSDocument autosaveWithImplicitCancellability:completionHandler:] ! ... [2] FILE ACCESS: Document: "Untitled.sketch2" -- State: WAITING ! 1 -[NSDocument performSynchronousFileAccessUsingBlock:] 2 -[NSDocument _checkAutosavingThenContinue:] ...!

Slide 99

Slide 99 text

(lldb) bt ... -[NSDocument performSynchronousFileAccessUsingBlock:] -[NSDocument _checkAutosavingThenContinue:] ... (lldb) po _NSDocumentSerializationInfo() Pending serialization requests (3 total) [0] FILE ACCESS: Document: "Untitled.sketch2" -- State: ACTIVE ! 1 -[NSDocument performAsynchronousFileAccessUsingBlock:] ! 2 -[SKTDocument doSomethingWithFile] ... [1] FILE ACCESS: Document: "Untitled.sketch2" -- State: WAITING ! 1 -[NSDocument performAsynchronousFileAccessUsingBlock:] ! 2 -[NSDocument autosaveWithImplicitCancellability:completionHandler:] ! ... [2] FILE ACCESS: Document: "Untitled.sketch2" -- State: WAITING ! 1 -[NSDocument performSynchronousFileAccessUsingBlock:] 2 -[NSDocument _checkAutosavingThenContinue:] ...!

Slide 100

Slide 100 text

(lldb) bt ... -[NSDocument performSynchronousFileAccessUsingBlock:] -[NSDocument _checkAutosavingThenContinue:] ... (lldb) po _NSDocumentSerializationInfo() Pending serialization requests (3 total) [0] FILE ACCESS: Document: "Untitled.sketch2" -- State: ACTIVE ! 1 -[NSDocument performAsynchronousFileAccessUsingBlock:] ! 2 -[SKTDocument doSomethingWithFile] ... [1] FILE ACCESS: Document: "Untitled.sketch2" -- State: WAITING ! 1 -[NSDocument performAsynchronousFileAccessUsingBlock:] ! 2 -[NSDocument autosaveWithImplicitCancellability:completionHandler:] ! ... [2] FILE ACCESS: Document: "Untitled.sketch2" -- State: WAITING ! 1 -[NSDocument performSynchronousFileAccessUsingBlock:] 2 -[NSDocument _checkAutosavingThenContinue:] ...!

Slide 101

Slide 101 text

(lldb) bt ... -[NSDocument performSynchronousFileAccessUsingBlock:] -[NSDocument _checkAutosavingThenContinue:] ... (lldb) po _NSDocumentSerializationInfo() Pending serialization requests (3 total) [0] FILE ACCESS: Document: "Untitled.sketch2" -- State: ACTIVE ! 1 -[NSDocument performAsynchronousFileAccessUsingBlock:] ! 2 -[SKTDocument doSomethingWithFile] ... [1] FILE ACCESS: Document: "Untitled.sketch2" -- State: WAITING ! 1 -[NSDocument performAsynchronousFileAccessUsingBlock:] ! 2 -[NSDocument autosaveWithImplicitCancellability:completionHandler:] ! ... [2] FILE ACCESS: Document: "Untitled.sketch2" -- State: WAITING ! 1 -[NSDocument performSynchronousFileAccessUsingBlock:] 2 -[NSDocument _checkAutosavingThenContinue:] ...!

Slide 102

Slide 102 text

- (void)doSomethingWithFile { [self performAsynchronousFileAccessUsingBlock:^(void (^completionHandler)(void)) { if ([self fileURL]) { [self performSomeFileAccessThenContinue:^{ completionHandler(); }]; } }]; }

Slide 103

Slide 103 text

- (void)doSomethingWithFile { [self performAsynchronousFileAccessUsingBlock:^(void (^completionHandler)(void)) { if ([self fileURL]) { [self performSomeFileAccessThenContinue:^{ completionHandler(); }]; } }]; }

Slide 104

Slide 104 text

- (void)doSomethingWithFile { [self performAsynchronousFileAccessUsingBlock:^(void (^completionHandler)(void)) { if ([self fileURL]) { [self performSomeFileAccessThenContinue:^{ completionHandler(); }]; } }]; }

Slide 105

Slide 105 text

- (void)doSomethingWithFile { [self performAsynchronousFileAccessUsingBlock:^(void (^completionHandler)(void)) { if ([self fileURL]) { [self performSomeFileAccessThenContinue:^{ completionHandler(); }]; } }]; }

Slide 106

Slide 106 text

- (void)doSomethingWithFile { [self performAsynchronousFileAccessUsingBlock:^(void (^completionHandler)(void)) { if ([self fileURL]) { [self performSomeFileAccessThenContinue:^{ completionHandler(); }]; } else { completionHandler(); } }]; }

Slide 107

Slide 107 text

Auto Save iCloud Adoption Responsiveness Serialization Versions Adoption Mechanics Best Practices

Slide 108

Slide 108 text

Versions

Slide 109

Slide 109 text

Versions •Revert and Versions Browser

Slide 110

Slide 110 text

Versions •Revert and Versions Browser •Periodically preserves document contents

Slide 111

Slide 111 text

Versions •Revert and Versions Browser •Periodically preserves document contents •Automatic

Slide 112

Slide 112 text

Pre-Save Preservation My Document My Document My Document (Backup)

Slide 113

Slide 113 text

Pre-Save Preservation Versions My Document My Document My Document (Backup)

Slide 114

Slide 114 text

Pre-Save Preservation Versions My Document My Document My Document (Backup)

Slide 115

Slide 115 text

Pre-Save Preservation Versions My Document My Document My Document My Document (Backup)

Slide 116

Slide 116 text

Pre-Save Preservation Versions Backup File Optimization My Document My Document My Document (Backup)

Slide 117

Slide 117 text

Pre-Save Preservation Versions Backup File Optimization My Document My Document My Document (Backup)

Slide 118

Slide 118 text

Pre-Save Preservation Versions Backup File Optimization My Document My Document My Document (Backup) My Document

Slide 119

Slide 119 text

Pre-Save Preservation Versions Backup File Optimization My Document My Document My Document (Backup) My Document

Slide 120

Slide 120 text

Pre-Save Preservation Versions Backup File Optimization My Document My Document -writeSafelyToURL:ofType:forSaveOperation:error: My Document (Backup) My Document

Slide 121

Slide 121 text

Pre-Save Preservation Versions Backup File Optimization My Document My Document -backupFileURL My Document (Backup) -writeSafelyToURL:ofType:forSaveOperation:error: My Document (Backup) My Document

Slide 122

Slide 122 text

Post-Save Preservation

Slide 123

Slide 123 text

Post-Save Preservation Finished Writing

Slide 124

Slide 124 text

Post-Save Preservation Finished Writing main thread Copy to Versions…

Slide 125

Slide 125 text

Post-Save Preservation Finished Writing main thread Copy to Versions…

Slide 126

Slide 126 text

Post-Save Preservation Finished Writing main thread Copy to Versions…

Slide 127

Slide 127 text

Post-Save Preservation Finished Writing main thread Copy to Versions…

Slide 128

Slide 128 text

Post-Save Preservation Finished Writing File Access main thread Copy to Versions…

Slide 129

Slide 129 text

Post-Save Preservation Finished Writing File Access main thread Copy to Versions…

Slide 130

Slide 130 text

Post-Save Preservation Finished Writing File Access main thread Copy to Versions… End File Access

Slide 131

Slide 131 text

Post-Save Preservation Finished Writing File Access main thread Copy to Versions… End File Access

Slide 132

Slide 132 text

Auto Save iCloud Adoption Responsiveness Serialization Versions Adoption Mechanics Best Practices

Slide 133

Slide 133 text

Auto Save iCloud Adoption Responsiveness Serialization Versions Adoption Mechanics Best Practices

Slide 134

Slide 134 text

Opening iCloud Documents

Slide 135

Slide 135 text

Opening iCloud Documents •App-Centric Open Panel

Slide 136

Slide 136 text

Opening iCloud Documents •App-Centric Open Panel •Non-modal

Slide 137

Slide 137 text

Opening iCloud Documents •App-Centric Open Panel •Non-modal •New API

Slide 138

Slide 138 text

Opening iCloud Documents •App-Centric Open Panel •Non-modal •New API Modal Only Non-modal Supported To Invoke To Override -URLsFromRunningOpenPanel -beginOpenPanelWithCompletionHandler: -runModalOpenPanel:forTypes: -beginOpenPanel:forTypes:completionHandler:

Slide 139

Slide 139 text

Getting Documents In and Out of iCloud For QC: Leave in ellipsis and colon

Slide 140

Slide 140 text

Getting Documents In and Out of iCloud •App-Centric Open Panel For QC: Leave in ellipsis and colon

Slide 141

Slide 141 text

Getting Documents In and Out of iCloud •App-Centric Open Panel •“Move To…” and “Move to iCloud” For QC: Leave in ellipsis and colon

Slide 142

Slide 142 text

Getting Documents In and Out of iCloud •App-Centric Open Panel •“Move To…” and “Move to iCloud” ■ NSDocument: -moveToURL:completionHandler: For QC: Leave in ellipsis and colon

Slide 143

Slide 143 text

Getting Documents In and Out of iCloud •App-Centric Open Panel •“Move To…” and “Move to iCloud” ■ NSDocument: -moveToURL:completionHandler: •Drafts For QC: Leave in ellipsis and colon

Slide 144

Slide 144 text

Drafts Ubiquity Container

Slide 145

Slide 145 text

Drafts Ubiquity Container Untitled

Slide 146

Slide 146 text

Drafts Ubiquity Container Untitled NSChangeDone

Slide 147

Slide 147 text

Drafts Ubiquity Container Untitled

Slide 148

Slide 148 text

Drafts Ubiquity Container Untitled NSAutosaveAsOperation

Slide 149

Slide 149 text

Drafts Ubiquity Container Untitled DRAFT NSAutosaveAsOperation

Slide 150

Slide 150 text

Drafts Ubiquity Container Untitled DRAFT NSAutosaveAsOperation Save

Slide 151

Slide 151 text

Drafts Ubiquity Container Untitled DRAFT NSAutosaveAsOperation Save Rename

Slide 152

Slide 152 text

Drafts Ubiquity Container Untitled DRAFT NSAutosaveAsOperation Save Rename Move

Slide 153

Slide 153 text

Drafts Ubiquity Container My Document DRAFT Save Rename Move

Slide 154

Slide 154 text

Drafts Ubiquity Container My Document Save Rename Move

Slide 155

Slide 155 text

Draft APIs

Slide 156

Slide 156 text

User Initiated Automatic Save In Place Save Elsewhere Save Elsewhere & Redirect “Save” — NSSaveOperation NSAutosaveInPlaceOperation “Export” — NSSaveToOperation NSAutosaveElsewhereOperation “Save As” — NSSaveAsOperation NSAutosaveAsOperation Draft APIs

Slide 157

Slide 157 text

User Initiated Automatic Save In Place Save Elsewhere Save Elsewhere & Redirect “Save” — NSSaveOperation NSAutosaveInPlaceOperation “Export” — NSSaveToOperation NSAutosaveElsewhereOperation “Save As” — NSSaveAsOperation NSAutosaveAsOperation Draft APIs 0 Accessors Customize Draft Name Disable Drafts -setDraft: & -isDraft -defaultDraftName +autosavesDrafts

Slide 158

Slide 158 text

User Initiated Automatic Save In Place Save Elsewhere Save Elsewhere & Redirect “Save” — NSSaveOperation NSAutosaveInPlaceOperation “Export” — NSSaveToOperation NSAutosaveElsewhereOperation “Save As” — NSSaveAsOperation NSAutosaveAsOperation Draft APIs 0 Accessors Customize Draft Name Disable Drafts -setDraft: & -isDraft -defaultDraftName +autosavesDrafts

Slide 159

Slide 159 text

User Initiated Automatic Save In Place Save Elsewhere Save Elsewhere & Redirect “Save” — NSSaveOperation NSAutosaveInPlaceOperation “Export” — NSSaveToOperation NSAutosaveElsewhereOperation “Save As” — NSSaveAsOperation NSAutosaveAsOperation Draft APIs 0 Accessors Customize Draft Name Disable Drafts -setDraft: & -isDraft -defaultDraftName +autosavesDrafts

Slide 160

Slide 160 text

Sending Changes

Slide 161

Slide 161 text

Coordinated Write Sending Changes

Slide 162

Slide 162 text

Coordinated Write Sending Changes

Slide 163

Slide 163 text

Coordinated Write ! Sending Changes

Slide 164

Slide 164 text

Sending Changes

Slide 165

Slide 165 text

Sending Changes

Slide 166

Slide 166 text

Receiving Changes

Slide 167

Slide 167 text

Receiving Changes

Slide 168

Slide 168 text

Receiving Changes

Slide 169

Slide 169 text

Receiving Changes

Slide 170

Slide 170 text

Coordinated Write Receiving Changes

Slide 171

Slide 171 text

Coordinated Write Receiving Changes !

Slide 172

Slide 172 text

Coordinated Write Revert Receiving Changes !

Slide 173

Slide 173 text

Coordinated Write Revert Receiving Changes !

Slide 174

Slide 174 text

Conflicting Changes

Slide 175

Slide 175 text

Conflicting Changes

Slide 176

Slide 176 text

Conflicting Changes

Slide 177

Slide 177 text

? Conflicting Changes

Slide 178

Slide 178 text

Conflicting Changes

Slide 179

Slide 179 text

Conflicting Changes

Slide 180

Slide 180 text

Conflicting Changes

Slide 181

Slide 181 text

Conflicting Changes

Slide 182

Slide 182 text

Conflicting Changes

Slide 183

Slide 183 text

Auto Save iCloud Adoption Responsiveness Serialization Versions Adoption Mechanics Best Practices

Slide 184

Slide 184 text

Best Practices

Slide 185

Slide 185 text

Best Practices •Override NSDocument as little as possible

Slide 186

Slide 186 text

Best Practices •Override NSDocument as little as possible •Eliminate open panel accessory views

Slide 187

Slide 187 text

Best Practices •Override NSDocument as little as possible •Eliminate open panel accessory views •Quick Look thumbnail and preview

Slide 188

Slide 188 text

Best Practices •Override NSDocument as little as possible •Eliminate open panel accessory views •Quick Look thumbnail and preview •File formats

Slide 189

Slide 189 text

Best Practices •Override NSDocument as little as possible •Eliminate open panel accessory views •Quick Look thumbnail and preview •File formats •Consider App running simultaneously on different devices

Slide 190

Slide 190 text

Best Practices •Override NSDocument as little as possible •Eliminate open panel accessory views •Quick Look thumbnail and preview •File formats •Consider App running simultaneously on different devices •Test reverting

Slide 191

Slide 191 text

Dropping Down a Level For QC: Colon part of code, leave in.

Slide 192

Slide 192 text

Dropping Down a Level •Foundation APIs For QC: Colon part of code, leave in.

Slide 193

Slide 193 text

Dropping Down a Level •Foundation APIs ■ File Coordination For QC: Colon part of code, leave in.

Slide 194

Slide 194 text

Dropping Down a Level •Foundation APIs ■ File Coordination ■ -URLForUbiquityContainerIdentifier: For QC: Colon part of code, leave in.

Slide 195

Slide 195 text

Dropping Down a Level •Foundation APIs ■ File Coordination ■ -URLForUbiquityContainerIdentifier: ■ NSMetadataQuery For QC: Colon part of code, leave in.

Slide 196

Slide 196 text

Dropping Down a Level •Foundation APIs ■ File Coordination ■ -URLForUbiquityContainerIdentifier: ■ NSMetadataQuery ■ -ubiquityIdentityToken For QC: Colon part of code, leave in.

Slide 197

Slide 197 text

Dropping Down a Level •Foundation APIs ■ File Coordination ■ -URLForUbiquityContainerIdentifier: ■ NSMetadataQuery ■ -ubiquityIdentityToken ■ NSUbiquityIdentityDidChangeNotification For QC: Colon part of code, leave in.

Slide 198

Slide 198 text

Dropping Down a Level •Foundation APIs ■ File Coordination ■ -URLForUbiquityContainerIdentifier: ■ NSMetadataQuery ■ -ubiquityIdentityToken ■ NSUbiquityIdentityDidChangeNotification •+usesUbiquitousStorage ■ Disable NSDocument iCloud features For QC: Colon part of code, leave in.

Slide 199

Slide 199 text

Auto Save iCloud Adoption Responsiveness Serialization Versions Adoption Mechanics Best Practices

Slide 200

Slide 200 text

Related Sessions Using iCloud with UIDocument Marina Wednesday 10:15AM Advanced iCloud Document Storage Marina Thursday 3:15PM Using iCloud with Core Data Mission Thursday 4:30PM

Slide 201

Slide 201 text

Open and Save Panels Within an App Sandbox Q & A Lab Essentials Lab B Wednesday 4:30PM Cocoa and OS X Gestures Lab Essentials Lab B Thursday 2:00PM iCloud Storage Lab Essentials Lab B Thursday 4:30PM Labs iCloud Storage Lab Essentials Lab B Friday 11:30AM Cocoa and XPC Lab Essentials Lab B Friday 10:30AM Security Lab Core OS Lab B Thursday 9:00AM

Slide 202

Slide 202 text

More Information Mike Jurewitz Developer Tools and Performance Evangelist [email protected]

Slide 203

Slide 203 text

No content

Slide 204

Slide 204 text

No content

Slide 205

Slide 205 text

No content

Slide 206

Slide 206 text

No content