gpt4 book ai didi

ios - 使用 Box api-Objective-c iOS 将文件上传到特定文件夹

转载 作者:行者123 更新时间:2023-11-29 00:43:06 25 4
gpt4 key购买 nike

我可以使用“fileUploadRequestToFolderWithID:BoxAPIFolderIDRoot”键成功地将文件上传到存储空间的根目录,但我想将文件上传到我使用创建的特定文件夹:

BOXContentClient *contentClient = [BOXContentClient defaultClient];
BOXFolderCreateRequest *folderCreateRequest = [contentClient folderCreateRequestWithName:@"New Folder" parentFolderID:BoxAPIFolderIDRoot];
[folderCreateRequest performRequestWithCompletion:^(BOXFolder *folder, NSError *error) {
// If successful, folder will be non-nil and represent the newly created folder on Box; otherwise, error will be non-nil.
}];

我如何检索用于上传文件的文件夹 ID?

提前致谢!

最佳答案

Box iOS SDK 将文件夹的 ID 称为文件夹的模型 ID。您可以在 folderCreateRequest 的完成 block 中访问文件夹的 modelID 属性。例如:

BOXContentClient *contentClient = [BOXContentClient defaultClient];
BOXFolderCreateRequest *folderCreateRequest = [contentClient folderCreateRequestWithName:@"New Folder" parentFolderID:BoxAPIFolderIDRoot];
[folderCreateRequest performRequestWithCompletion:^(BOXFolder *folder, NSError *error) {
NSString *folderID = folder.modelID;
}];

关于ios - 使用 Box api-Objective-c iOS 将文件上传到特定文件夹,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39000805/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com