关于我的设置的一些话:
MacOs Catalina 10.15.2
谈论git我桌面上的项目文件夹,它与 iCloud Drive 同步桌面和文档文件夹选项已启用
我注意到以下情况时不时发生一段时间。昨天,我将 MacBook Pro 备份到了MacOs Catalina 10.15.2,这似乎加剧了我在git初始化的项目文件夹中注意到的以下特性:
很多时候,当我deleted files从我local worktree那里开始时,它们随机开始重新出现在工作树中(有时甚至一天或更长时间后)作为untracked files.
其次,很经常地,我现有的文件似乎突然出现duplicated- 它们的副本带有数字后缀,例如文件 foo 突然出现foo 2,而文件 bar 出现bar 6. 然后它们也出现在git statusas 中untracked files。
工作树索引中出现重复项的示例
我还在.git文件夹内观察到了这种行为。
.git 文件夹中出现重复项的示例
* 编辑:值得注意的是,<filename> 2重复似乎源于上一次,有时甚至是一个月前(参见上面 .git 文件夹截图中的“配置 2”)。我还注意到(但我提供的图片上没有显示)有时数字后缀是一个随机的“6”,例如没有数字后缀序列(例如 1-5)导致重复的文件名与数字 6 .
我时不时地观察到这种情况发生,但今天它无处不在。可能是这个问题特别出现在我做一些git诸如此类的操作时git commit git reset。
我的假设是,这一定与.git不能很好地使用 …
我的 iPhone 应用程序的文档文件夹与文件应用程序上的 iCloud 位置有问题。我的应用程序的文档文件夹出现在文件应用程序的设备端,但没有出现在文件应用程序的 iCloud 位置。iCloud 仪表板清楚地显示了使用我的应用程序创建的默认 iCloud 容器,但它没有出现在 iPhone 的文件应用程序上。如何让我的 iPhone 应用程序的文档文件夹出现在文件应用程序的 iCloud 位置?
我已经iCloud在 iPhone 应用程序项目的 XCode 中安装了默认容器。我将UIFileSharingEnabledas YES 和LSSupportOpeningDocumentsInPlaceas YES 添加到我的 plist 文件中。因此,我可以在 iPhone 的文件应用程序的设备端看到我的应用程序的文档文件夹,但在 iCloud 驱动器端看不到该文件夹。
我已将 iCloud 项目添加到苹果开发者帐户上此应用程序的配置中,以便我可以编辑其功能并启用所有 iCloud 复选框。
这样我就可以在 XCode 上获取 url UbiquityContainer。
但是当我尝试使用iCloudDocumentSync库的iCloud.shared()?.checkAvailability()功能时,它说 iCloud url 为零,因此无法获取 iCloud 可用性。
我希望您能帮助我配置我的应用程序项目的云设置,以便我的应用程序文档目录出现在 iCloud 驱动器上,并且我可以正确使用 CloudKit。谢谢。
iOS有一个类似的问题,但我发现建议的解决方案在所有情况下都不适用于 macOS。
在 Mac 上,有许多可能的垃圾文件夹:
/.Trashes~/.Trash~/Library/Mobile Documents/com~apple~CloudDocs/.Trash – 这个来自 iCloud/Users/xxx/.Trash – 任何其他用户的垃圾/Volumes/xxx/.Trashes此代码应该有效,但不适用于 iCloud 垃圾箱:
NSURL *theURL = ...;
NSURLRelationship relationship = NSURLRelationshipOther;
NSError *error = nil;
[NSFileManager.defaultManager
getRelationship: &relationship
ofDirectory: NSTrashDirectory
inDomain: 0
toItemAtURL: theURL
error: &error];
BOOL insideTrash = !error && (relationship == NSURLRelationshipContains);
Run Code Online (Sandbox Code Playgroud)
如果 URL 指向任何 iCloud 文件夹(包括上面显示的垃圾文件夹),我会收到此错误:
Error Domain=NSCocoaErrorDomain Code=3328
"The requested operation couldn’t be completed because the feature is not supported."
Run Code Online (Sandbox Code Playgroud)
奇怪的是,即使是 10.15 SDK 中“NSFileManager”的头文件也建议使用相同的代码:
/* trashItemAtURL:resultingItemURL:error: [...] …Run Code Online (Sandbox Code Playgroud) 我正在使用这个问题的稍微更新的代码:下载 iCloud 文件的方法?非常混淆?
这是代码的摘录:
private func downloadUbiquitiousItem(atURL url: URL) -> Void {
do {
try FileManager.default.startDownloadingUbiquitousItem(at: url)
do {
let attributes = try url.resourceValues(forKeys: [URLResourceKey.ubiquitousItemDownloadingStatusKey])
if let status: URLUbiquitousItemDownloadingStatus = attributes.allValues[URLResourceKey.ubiquitousItemDownloadingStatusKey] as? URLUbiquitousItemDownloadingStatus {
if status == URLUbiquitousItemDownloadingStatus.current {
self.processDocument(withURL: url)
return
} else if status == URLUbiquitousItemDownloadingStatus.downloaded {
self.processDocument(withURL: url)
return
} else if status == URLUbiquitousItemDownloadingStatus.notDownloaded {
do {
//will go just fine, if it is unnecessary to download again
try FileManager.default.startDownloadingUbiquitousItem(at: url)
} catch {
return …Run Code Online (Sandbox Code Playgroud) 在我的 iOS 应用程序中,我打开了一个UIDocumentMenuViewController. 当我使用UIDocumentPickerModeImport模式调用它时,一切正常(我的所有 iCloud 权限都已设置)。
UIDocumentPickerModeExportToService但是,当我使用 调用它时,应用程序崩溃并出现以下错误:
断言失败 -[UIDocumentMenuViewController initWithDocumentTypes:inMode:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKit/UIKit-3600.6.22/UIDocumentMenuViewController.m:71
由于未捕获的异常“NSInternalInconsistencyException”而终止应用程序,原因:“-[UIDocumentMenuViewController initWithDocumentTypes:inMode:] 只能以导入或打开模式调用”
我究竟做错了什么?为什么只能在导入或打开模式下调用?
我的代码:
UIDocumentMenuViewController *exportMenu = [[UIDocumentMenuViewController alloc] initWithDocumentTypes:@[@"public.image"]
inMode:UIDocumentPickerModeExportToService];
exportMenu.delegate = self;
[self presentViewController:exportMenu animated:YES completion:nil];
Run Code Online (Sandbox Code Playgroud)
这发生在模拟器和我测试过的两个设备上(都运行 iOS 10)。
任何帮助将不胜感激!