检查自定义键盘扩展的完全访问权限 [英] Check full access for custom keyboard extension

查看:609
本文介绍了检查自定义键盘扩展的完全访问权限的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要检查自定义键盘扩展的完全访问权限。我找到了这个链接。

I need to check full access for custom keyboard extension. I found this link.

如何检查允许完全访问在iOS 8中启用了吗?

它说我们可以查看App组。我有app组称为group.TTT.TGroup。它共享主应用和自定义键盘之间的访问权限。

It say we can check App group. I have app group called "group.TTT.TGroup". It share access between main app and custom keyboard.

然后,我这样检查。问题是我总是可以访问它(总是有数组或错误= null)。是因为我在分享相同的数据吗?但是,如果我的应用程序使用其他应用程序组和扩展程序使用其他应用程序组,我无法访问它。我可以知道怎么办?

Then, I check like this. Problem is that I always have access to that (always has array or error = null). Is it because I am sharing same data? But, if my app use another app group and extension use other app group, I can't definitely access to that. May I know how to do?

NSFileManager* fileManager = [NSFileManager defaultManager];
NSString *path = [fileManager containerURLForSecurityApplicationGroupIdentifier:@"group.TTT.TGroup"].path;
NSError *error;
NSArray *arr = [fileManager contentsOfDirectoryAtPath:path error:&error];

NSLog(@" arr is %@",arr);
if (arr == nil || !arr) //can check error also
    accessOn = NO;

else accessOn = YES;


推荐答案

您可以尝试从共享<$中读取值c $ c> NSUserDefaults - 如果值为null,则allowFullAccess关闭

You can try reading a value from the shared NSUserDefaults - if the value is null, then allowFullAccess is off

或者您可以尝试使用共享文件系统读取文件 containerURLForSecurityApplicationGroupIdentifier

Or you can try reading files from the shared file system using containerURLForSecurityApplicationGroupIdentifier

这篇关于检查自定义键盘扩展的完全访问权限的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆