gpt4 book ai didi

ios - 应用程序组在我的消息过滤器扩展和主机应用程序之间不起作用

转载 作者:行者123 更新时间:2023-11-29 00:06:17 26 4
gpt4 key购买 nike

我过去曾为我的其他应用程序(在 Today 扩展和主机应用程序之间)运行过此操作,但是,对于使用 Xcode 9.1 创建的全新应用程序,我看到了奇怪的错误:

2017-12-25 17:16:42.077247+0530 Controller[851:11684] [User Defaults] Couldn't read values in CFPrefsPlistSource<0x10470c970> (Domain: group.com.judepereira, User: kCFPreferencesAnyUser, ByHost: Yes, Container: (null), Contents Need Refresh: Yes): Using kCFPreferencesAnyUser with a container is only allowed for System Containers, detaching from cfprefsd
2017-12-25 17:16:42.079711+0530 Controller[851:11707] [User Defaults] Couldn't write value for key idc in CFPrefsPlistSource<0x10470c620> (Domain: group.com.judepereira, User: kCFPreferencesCurrentUser, ByHost: No, Container: (null), Contents Need Refresh: No): setting preferences outside an application's container requires user-preference-write or file-write-data sandbox access, switching to read-only
2017-12-25 17:16:42.081354+0530 Controller[851:11707] [User Defaults] Couldn't write value for key rules in CFPrefsPlistSource<0x10470c620> (Domain: group.com.judepereira, User: kCFPreferencesCurrentUser, ByHost: No, Container: (null), Contents Need Refresh: No): Operation not allowed, switching to read-only

我已遵循 here 指定的指南和 here .此外,更奇怪的是它在主机应用程序中完美运行。仅当我的消息过滤器扩展尝试更新此应用组的用户默认值时,我才会看到这些随机错误。

以下是我的更新方式:

NSUserDefaults *defaults = [[NSUserDefaults alloc]
initWithSuiteName:@"group.com.judepereira"];

NSLog(@"idc=%@", [defaults objectForKey:@"idc"]);
[defaults setObject:@"judepereira" forKey:@"idc"];

此外,我已阅读 herehere关于设备重新启动如何解决它,以及这些错误消息只是一些虚假的警告。

最佳答案

经过进一步调查,此特定扩展中不允许这样做苹果的回答。

For privacy reasons, the system handles all communication with your associated server; your Message Filter app extension can't access the network directly.

Also for privacy reasons, your app extension can't write data to containers shared with the containing app.

You should not be writing data to a shared container for this particular type of Application Extension. Generally, you can use App Groups with NSUserDefaults to communicate information between your App and its Extensions.

关于ios - 应用程序组在我的消息过滤器扩展和主机应用程序之间不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47968383/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com