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

Uploading file to a specific folder with Box api- Objective-c iOS

我可以使用“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 的完成块中访问文件夹的模型 ID 属性。例如:

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