Repository navigation
iCloud Drive のフォルダにアプリのアイコンを出す - #141
Merged
Merged
Conversation
The "Tortoise Blocks" folder in iCloud Drive was a plain folder the document browser made, and a plain folder cannot carry an icon; only the app's own ubiquity container, published through NSUbiquitousContainers, can. Claim iCloud.space.hiraku.tortoiseblocks with CloudDocuments and publish its document scope. macOS keeps its old entitlements: iCloud needs a provisioning profile, and the Mac's Debug loop is ad-hoc signed without a team. The bare CODE_SIGN_ENTITLEMENTS carries iCloud and [sdk=macosx*] opts out, so a platform added later inherits it rather than silently losing it. Refs #140
The document browser makes a new document wherever it is looking, not in the app's container, so nothing ever asked for the container and iCloud Drive had no folder to show. Ask for it at launch, off the main actor, and create its Documents folder. From an app delegate rather than a view's task: no single view is there on every launch. Refs #140
An empty Documents folder stayed out of iCloud Drive on an iPhone — in the Files app and in the app's own browser, minutes later — and appeared, with its icon, once an empty .keep was inside it. Hidden, so a child has nothing to find or delete, and a marker already there, or its .icloud placeholder from another device, is left alone. Written through a file coordinator, as writes into a ubiquity container have to be. Refs #140
20 of 23 tasks
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
iCloud Drive の「Tortoise Blocks」フォルダに、アプリのアイコンが出るようにします(#140)。iPhone / iPad / Vision Pro が対象で、Mac は対象外です。
iCloud.space.hiraku.tortoiseblocksをCloudDocumentsで使い、NSUbiquitousContainersでDocuments/を公開します。これまでのフォルダは書類ブラウザが作ったただのフォルダで、ただのフォルダにはアイコンを付けられません。CODE_SIGN_ENTITLEMENTS[sdk=macosx*]で今のファイルを使い続けます。iCloud には provisioning profile が要るので、チームなしの ad-hoc 署名で回している Mac の Debug ビルドが起動しなくなるためです。指定のないときは iCloud ありなので、後から増えるプラットフォームは iCloud を引き継ぎます。UbiquityContainer.prepare()):DocumentGroupは新規書類をブラウザがいま開いているフォルダに作るだけで、コンテナには触らないためです。.keepを置く:空のDocuments/は iCloud Drive に表示されません。iPhone の実機で、.keepを置くとアイコン付きで表示されることを確かめました。確かめたこと
既定の保存先をコンテナにする公式の API はありません。このため、リリースノートで新しいフォルダの開き方を案内します(下書きは #140 のコメント)。TestFlight ビルドでの確認などの手作業が #140 に残っているので、この PR では Issue を閉じません。
Refs #140