微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

对于由containerURLForSecurityApplicationGroupIdentifier

如何解决对于由containerURLForSecurityApplicationGroupIdentifier

我需要我的ObjC应用程序才能从共享的App Group容器中读取文件。 但是我从containerURLForSecurityApplicationGroupIdentifier中得到零。

App Group和App ID设置为OK。第二个应用程序(Xamarin.IOS)能够读写 毫无问题地放入相同的应用组。

#define APP_GROUP_PATH [[[NSFileManager defaultManager] containerURLForSecurityApplicationGroupIdentifier:@"group.com.movano.FileSharingAug26a"] path]

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    NSLog(@"");
    NSLog(@"");
    NSLog(@"");
    NSLog(@"-----------------------------------------");
    NSLog(@"------------------ APP_GROUP_PATH -----------------------");
   // NSLog( APP_GROUP_PATH );
    NSLog(@"-----------------------------------------");
    NSLog(@"Shared container data:%@",[self listFileAtPath:APP_GROUP_PATH]);
    
}


-(NSArray *)listFileAtPath:(Nsstring *)path     //  <--- path is nil
{
    int count;

    NSArray *directoryContent = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:path error:NULL];
    for (count = 0; count < (int)[directoryContent count]; count++)
    {
        NSLog(@"File %d: %@",(count + 1),[directoryContent objectAtIndex:count]);
    }
    return directoryContent;
}

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。