在 iOS 8 模拟器上操作应用程序权限

Manipulate app permissions on iOS 8 simulator

this one 相同的问题,但 iOS 8.

在 运行 xctests 时,如何以编程方式确保权限 granted/denied?

是否使用相同的TCC.db?如果是这样,因为没有 $HOME/Library/Application Support/iPhone Simulator/8.x 个目录,它移动到哪里了?

感谢 username tbd,TCC.db 仍在使用,但现在位于

$HOME/Library/Developer/CoreSimulator/Devices/$DEVICEID/data/Library/TCC/

"access"table 的架构相同。

NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *dbPath = [paths firstObject];

for (int ii = 0; ii < 5; ii++) {
    dbPath = [dbPath stringByDeletingLastPathComponent];
}

dbPath = [[[dbPath stringByAppendingPathComponent:@"Library"]
           stringByAppendingPathComponent:@"TCC"]
          stringByAppendingPathComponent:@"TCC.db"];

请注意,TCC 仅适用于帐户访问(联系人、邮件等),并非所有权限。