Manipulate app permissions on iOS 8 simulator

孤人 提交于 2019-12-10 12:06:56

问题


Same question as this one, but for iOS 8.

While running xctests, how can I make sure permissions are granted/denied programmatically?

Is the same TCC.db used? If so, as there are no $HOME/Library/Application Support/iPhone Simulator/8.x directories, where has it moved to?


回答1:


Thanks to username tbd, the TCC.db is still in use, but is now located at

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

Schema of the "access" table is the same.

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"];

Note though that TCC is only for Accounts access (contacts, mail, etc.) and not all permissions.



来源:https://stackoverflow.com/questions/30106320/manipulate-app-permissions-on-ios-8-simulator

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!