【发布时间】:2016-03-25 07:59:54
【问题描述】:
我在这里阅读过有关 kinvey 的文档: http://devcenter.kinvey.com/ios/guides/files#DownloadingtoCachesDirectory
他们也提供了示例函数:
[KCSFileStore downloadData:@"myId" completionBlock:^(NSArray *downloadedResources, NSError *error) {
if (error == nil) {
KCSFile* file = downloadedResources[0];
NSData* fileData = file.data;
id outputObject = nil;
if ([file.mimeType hasPrefix:@"text"]) {
outputObject = [[NSString alloc] initWithData:fileData encoding:NSUTF8StringEncoding];
} else if ([file.mimeType hasPrefix:@"image"]) {
outputObject = [UIImage imageWithData:fileData];
}
NSLog(@"downloaded: %@", outputObject);
} else {
NSLog(@"Got an error: %@", error);
}
} progressBlock:nil];
但是当我用文件 id 替换“myId”时,它给了我这个错误:
Error Domain=KCSServerErrorDomain Code=401 "The credentials used to authenticate this request are not authorized to run this operation. Please retry your request with appropriate credentials"
虽然我可以使用相同的凭据(秘密、api_key)访问我通过 kinvey(同一用户)创建的其他集合
在调用这个函数之前还有什么要求吗?
谢谢
【问题讨论】:
标签: ios objective-c iphone download kinvey