我可以通过使用[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.");
}
});
}];
});
}];
children总是nil。我也尝试了[Box rootFolder],但结果相同。
谁能帮我一下吗?谢谢。我想下面的示例可能会有帮助。
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!");
}