我似乎没有管理使用dropbox api操作的文件副本.我可以成功授权我的客户端,下载和上传文件.复制操作需要使用POST方法,我认为这是我产生错误请求的地方.我正在定义OAuth身份验证的POST方法,并使用Indy TIdHTTP发布请求,但我总是收到错误代码403 - 权限被拒绝.
这是dropbox api描述:https://www.dropbox.com/developers/reference/api#fileops-copy
这是我的代码的一部分:
ParamStr := Format('root=%s&from_path=%s&to_path=%s', [Root, EncodeFileName(FromPath), EncodeFileName(ToPath)]);
URL := 'https://api.dropbox.com/1/fileops/copy' + '?' + ParamStr;
Consumer := TOAuthConsumer.Create(Key, Secret);
AToken := TOAuthToken.Create(fToken, fTokenSecret);
HMAC := TOAuthSignatureMethod_HMAC_SHA1.Create;
ARequest := TOAuthRequest.Create('');
try
ARequest.HTTPURL := URL;
ARequest.Method := 'POST';
ARequest := ARequest.FromConsumerAndToken(Consumer, AToken, '');
ARequest.Sign_Request(HMAC, Consumer, AToken);
Params := TStringList.Create;
try
Params.Text := ParamStr + '&' + ARequest.GetString;
HTTP.Post(URL, Params);
finally
Params.Free;
end;
Run Code Online (Sandbox Code Playgroud) 我正在尝试使用iCloud Documents来存储我的iOS应用程序中的XML文件.一切似乎工作正常(我可以无错误地编写和阅读文件),除了我的App文件不会出现在icloud.com和developer.icloud.com以及iCloud Drive文件夹中的Windows PC上的iCloud Documents中.我在模拟器中运行应用程序,并在真实设备上使用TestFlight进行测试.我安装了最新版本的iCloud for Windows 4.0.该应用程序是在Xcode 6中创建的.
有谁知道如何使文件出现在iCloud Documents中?
我用来保存文件的代码:
NSLog(@"Syncing with iCloud");
NSURL *ubiq = [filemgr URLForUbiquityContainerIdentifier:nil];
if (ubiq) {
NSURL *ubiquitousPackage = [ubiq URLByAppendingPathComponent:@"Documents" isDirectory:YES];
if ([filemgr fileExistsAtPath:[ubiquitousPackage path]] == NO)
[filemgr createDirectoryAtURL:ubiquitousPackage
withIntermediateDirectories:YES
attributes:nil
error:nil];
ubiquitousPackage = [ubiquitousPackage URLByAppendingPathComponent:@"data.pxa"];
DataFile *file = [[DataFile alloc] initWithFileURL:ubiquitousPackage];
file.xmlContent = doc.XMLString;
[file saveToURL:[file fileURL] forSaveOperation:UIDocumentSaveForCreating | UIDocumentSaveForOverwriting completionHandler:^(BOOL success) {
if (success) {
NSLog(@"Synced with iCloud: %@", [ubiquitousPackage path]);
} else {
NSLog(@"Syncing with iCloud failed");
}
}]; …Run Code Online (Sandbox Code Playgroud) delphi ×1
dropbox-api ×1
icloud ×1
indy ×1
ios ×1
oauth ×1
objective-c ×1
uidocument ×1
xcode ×1