使用Gmail在Mailcore2中创建子文件夹

时间:2015-11-04 11:18:30

标签: ios objective-c imap mailcore2

我在github上关注了线程:https://github.com/MailCore/mailcore2/issues/321

随后使用以下代码:

MCOIMAPFetchNamespaceOperation * op = [session fetchNamespaceOperation];
[op start:^(NSError * error, NSDictionary * namespaces) {
    if (error != nil)
        return;
    MCOIMAPNamespace * ns = [namespaces objectForKey:MCOIMAPNamespacePersonal];
    NSString * path = [ns pathForComponents:[NSArray arrayWithObjects:@"test", @"sub1", nil]];
    MCOIMAPOperation * createOp = [session createFolderOperation:path];
    [createOp start:^(NSError * error) {
    }];

    path = [ns pathForComponents:[NSArray arrayWithObjects:@"test", @"sub2", nil]];
    createOp = [session createFolderOperation:path];
    [createOp start:^(NSError * error) {
    }];

    path = [ns pathForComponents:[NSArray arrayWithObjects:@"test", @"sub3", nil]];
    createOp = [session createFolderOperation:path];
    [createOp start:^(NSError * error) {
    }];
}];

但是,当我登录桌面Gmail帐户时,我发现文件夹结构如下所示:

On GMail

而不是我期望的子文件夹结构,例如,邮箱:

enter image description here

我在做什么或者这是Mailcore2的错误吗?

编辑:答案是首先创建父文件夹,然后创建子文件夹。

1 个答案:

答案 0 :(得分:1)

创建"测试"文件夹首先,对于那些是。的子文件夹。

否则你会留下一个"虚拟"测试文件夹,在gmail web ui的情况下,将显示斜杠。