【发布时间】:2017-03-29 19:31:27
【问题描述】:
所以我有一个带有共享扩展的应用程序,每个应用程序都有自己的目标。应用程序包标识符的核心是com.company.app,共享扩展是com.company.app.share。每个都有自己的权利文件,核心应用程序为App Groups -> group.com.company.app,共享扩展名相同。这两个包标识符都列在苹果开发者网站上,但出于某种原因,
我似乎没有写入共享private/var/mobile/Containers/Shared/AppGroup/XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX/Library/Caches/ 目录的正确权限。
我得到的错误信息是:
You don’t have permission to save the file “Caches” in the folder “Library”.
目录保存如下:
GetZipURLInItems(self.extensionContext.inputItems, ^(NSURL *url, NSError *error) {
if (error == nil) {
NSURL *containerURL = [[[NSFileManager defaultManager] containerURLForSecurityApplicationGroupIdentifier:GroupIdentifier] URLByAppendingPathComponent:@"Library/Caches"];
NSLog(@"EXT: containerURL: %@", containerURL);
[WPZipArchive unzipFileAtPath:[url path] toDestination:[containerURL absoluteString]];
[self listDirectoryAtPath:[containerURL absoluteString]];
}});
我在这里缺少什么?
【问题讨论】:
-
你是怎么写的?看看使用 NSFileManager:containerURLForSecurityApplicationGroupIdentifier
-
@Essenceofchickens 我更新了原始问题以显示我如何保存目录。
-
你试过没有 URLByAppendingPathComponent: 部分吗?
标签: ios permissions filesystems ios8-share-extension bundle-identifier