iOS在应用程序和WatchKit扩展中以编程方式从授权读取应用程序组

iOS在应用程序和WatchKit扩展中以编程方式从授权读取应用程序组,ios,objective-c,xcode,continuous-integration,watchkit,Ios,Objective C,Xcode,Continuous Integration,Watchkit,是否有任何方法可以通过编程方式从授权中读取AppGroup NSString *path = [[NSBundle mainBundle] pathForResource:@"MY_APP_TARGET_NAME" ofType:@"entitlements"]; NSDictionary *dict = [[NSDictionary alloc]initWithContentsOfFile:pat

是否有任何方法可以通过编程方式从授权中读取AppGroup

NSString *path = [[NSBundle mainBundle] pathForResource:@"MY_APP_TARGET_NAME"
                                                 ofType:@"entitlements"];
NSDictionary *dict = [[NSDictionary alloc]initWithContentsOfFile:path];
NSArray *appGroups = [dict objectForKey:@"com.apple.security.application-groups"];

for(NSString *appGroupValue in appGroups) {

    if([appGroupValue hasPrefix:@"group.com.xyz.myAppName"]) {
        appGroup = appGroupValue;
    }
}
我已经实现了以编程方式读取AppGroup,但无法以编程方式获取授权文件名。您能否建议如何以编程方式从生成设置中读取
code\u SIGN\u权限的值

NSString *path = [[NSBundle mainBundle] pathForResource:@"MY_APP_TARGET_NAME"
                                                 ofType:@"entitlements"];
NSDictionary *dict = [[NSDictionary alloc]initWithContentsOfFile:path];
NSArray *appGroups = [dict objectForKey:@"com.apple.security.application-groups"];

for(NSString *appGroupValue in appGroups) {

    if([appGroupValue hasPrefix:@"group.com.xyz.myAppName"]) {
        appGroup = appGroupValue;
    }
}