0

我可以使用 [Box createFolderWithName:] 来获取 folder_id。但是当我尝试使用 folder_id 来获取它的孩子时,它不起作用。这是我的代码:

[Box createFolderWithName:@"My APP" parentFolderID:[Box rootFolderID] share:NO callbacks:^(id<BoxOperationCallbacks>on){

    on.userInfo (^(NSDictionary* result) {
        // do something with the return value (typically stored with key @"results") of the operation

        NSNumber *appFolderId = [result objectForKey:@"folder_id"];
        BoxFolder *appFolder = [Box folderWithID:appFolderId];
        [appFolder updateWithCallbacks:^(id<BoxOperationCallbacks>on){
            on.after(^(BoxCallbackResponse response) {
                if (response == BoxCallbackResponseSuccessful) {
                    NSLog(@"Folder updated. Children count is: %d", [appFolder.children count]);
                    // Send a notification, call a delegate, use KVO use locally or whatever to use the children.
                }
                else {
                    NSLog(@"Folder not updated.");
                }
            });


        }];


    });

}];

孩子总是零。我也尝试了 [Box rootFolder] 但结果相同。

有人可以帮我吗?谢谢。

4

1 回答 1

0

我认为以下示例可能会有所帮助。

if (appFolder.isFolder) {
        [appFolder updateWithCallbacks:^(id<BoxOperationCallbacks> on) {
            on.after(^(BoxCallbackResponse response) {
                if (response == BoxCallbackResponseSuccessful) {
                    NSLog(@"Folder updated. Children count is: %d", [appFolder.children count]);
                    // Send a notification, call a delegate, use KVO use locally or whatever to use the children.
                }
                else {
                    NSLog(@"Folder not updated.");
                }
            });
        }];
    }
    else {
        NSLog(@"NOT WORKING WITH A FOLDER!");
    }
于 2013-03-27T14:41:48.687 回答