117*_*f96 7 swift4 ios13 xcode11 macos-catalina mac-catalyst
I recently updated to macOS Catalina so I could update some of my apps with Mac support using Catalyst. Whenever I run the app and it tries to access the CloudKit data (I use CloudKit to sync Core Data, Data if an iCloud Account is available), it then crashes with the following error. [User Defaults] Couldn't write values for keys (
ApplicationAccessibilityEnabled
) in CFPrefsPlistSource<0x600002c07700> (Domain: com.apple.Accessibility, User: kCFPreferencesCurrentUser, ByHost: No, Container: (null), Contents Need Refresh: Yes): setting preferences outside an application's container requires user-preference-write or file-write-data sandbox access
I have tried changing Permissions and Access in App SandBox settings in my Signing and Capabilities, to read/write. I have also tried changing incoming and outgoing connections to on.
I am not exactly sure what code I should show so here is the area is crashes in.
if isICloudContainerAvailable() {
print("iCloud Available")
let container = NSPersistentCloudKitContainer(name: "Shopping_App")
container.loadPersistentStores(completionHandler: {
(storeDescription, error) in
if let error = error as NSError? {
fatalError("Unresolved error \(error), \(error.userInfo)")
}
})
return container
}
Run Code Online (Sandbox Code Playgroud)
I except the app to create/get the CoreData data and if available (which is in this case) to connect to the CloudKit synced data. But it crashes right now before it even brings up any views which leads me to think that it is crashing in the AppDeleget somewhere.
Update Oct. 14 -- I found that if I force Jump Over the Breakpoint where the app crashes, I can continue into the app and it works fine. Which leads me to think that the error is really in the AppDeleget especially saying that the UI does not appear until after I jump over the breakpoint it sets at the crash.
Update Nov. 4 -- So this problem gets even stranger. I forgot I was using a beta version of Xcode, so ok, it could have just been that after I realized that last week. I tried running the app through the public version and the app never stopped for a breakpoint but instead completely crashes with Thread 1: EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0). This error is just really odd. Would this be an error that I should report to Apple? I thought about doing that but I decided not to because it seemed to me like something I could have been doing, but now rethinking whether I should or not. I wish I could find the solution to this problem because I would like to release the macOS version to the public, but have not had any luck finding a solution.
Update Nov. 8 -- In Xcode 11.2.1 GM seed the problem still persists. I have yet to find the exact reason this problem occurs but will continue to try. I have also been unable to reproduce the error written in the update on Nov. 4, on any Xcode version. I have not found anything else but wanted to update this with information about the GM seed and if this still happens.
Update Nov. 13 -- I decided to just go ahead and upload the app to Apple for approval since building the app and running it independently from Xcode worked just fine. Apple approved the app without any complaints of this issue. This just seems to be an Xcode issue. I will continue to update this however and if/when I find a solution I will post the solution to this problem but have not found anything more to workaround or solve this problem.
Update Nov. 20:
在Xcode 11.3 Beta Build 11C24b上,仍然会出现此问题。没有其他改变,我也没有找到其他解决该问题的方法。我将继续保持此更新,但尚未找到其他任何内容。
MasterChief96,你并不孤单。这是我的设置:
MacOS 10.15.3 Xcode 11.4.1
我创建了一个全新的 SwiftUI“Hello World”项目,启用 Mac 作为目标设备,又名 Catalyst。
我将 iOS 部署目标设置为 13.2(否则我会收到 MacOS 运行时错误,提示我需要 Catalina 10.15.4)
将scheme设置为“My Mac”,编译运行得到:
[User Defaults] Couldn't write values for keys
ApplicationAccessibilityEnabled
AccessibilityEnabled
FullKeyboardAccessFocusRingEnabled
setting preferences outside an application's container requires user-preference-write or file-write-data sandbox access
Run Code Online (Sandbox Code Playgroud)
由于它指的是沙箱,因此我更改了应用程序沙箱的“签名和功能”设置,以包括用户选择的读/写和下载文件访问。
我相当Xcode,删除项目的派生数据,打开项目并运行。在 MacOS 上运行时,错误消息仍然存在。(在 iOS 上运行时我看不到这些消息。)
只是猜测,但这似乎是 Catalyst 环境中的另一个错误?也许这个错误已在 Catalina 10.15.4 中修复,但该更新对我来说是一场灾难,我不得不将端口返回到 10.15.3。
| 归档时间: |
|
| 查看次数: |
496 次 |
| 最近记录: |