iPhone 中的 Dropbox Api

发布于 2024-11-09 04:38:23 字数 763 浏览 0 评论 0原文

我正在尝试将 dropbox 与 iphone 集成并使用登录选项完成。我想在登录后立即在表视图中加载根路径上的文件夹和文件。

代码是

- (void)viewWillAppear:(BOOL)animated {
          [self.restClient loadMetadata:@"/"];
}

这个 loadMetadata 是 DBRestClient.m 类中的方法。我设法在控制台上打印 json 值

代码是

- (void)parseMetadataWithRequest:(DBRequest*)request {
    NSAutoreleasePool* pool = [NSAutoreleasePool new];

    NSDictionary* result = (NSDictionary*)[request resultJSON];
    DBMetadata* metadata = [[[DBMetadata alloc] initWithDictionary:result] autorelease];
    [self performSelectorOnMainThread:@selector(didParseMetadata:) withObject:metadata waitUntilDone:NO];
    NSLog(@"Meta data is :%@",result);
    [pool drain];
}

如何在视图控制器中使用此结果值以在表视图中显示它?

I am trying to integrate dropbox with iphone and done with login option.I want to load folders and files on root path in table view just after login.

code for this is

- (void)viewWillAppear:(BOOL)animated {
          [self.restClient loadMetadata:@"/"];
}

This loadMetadata is method in DBRestClient.m class.I managed to print json value on console

Code is

- (void)parseMetadataWithRequest:(DBRequest*)request {
    NSAutoreleasePool* pool = [NSAutoreleasePool new];

    NSDictionary* result = (NSDictionary*)[request resultJSON];
    DBMetadata* metadata = [[[DBMetadata alloc] initWithDictionary:result] autorelease];
    [self performSelectorOnMainThread:@selector(didParseMetadata:) withObject:metadata waitUntilDone:NO];
    NSLog(@"Meta data is :%@",result);
    [pool drain];
}

How could I use this result value in my view controller to display this in tableview?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

天赋异禀 2024-11-16 04:38:23

获取目录的内容并将它们放入数组中。

- (void)restClient:(DBRestClient*)client loadedMetadata:(DBMetadata*)metadata 
{
    for (DBMetadata* child in metadata.contents) 
    {
        if (child.isDirectory)
        {
            [self.restClient loadMetadata:child.path withHash:hash];
        } 
        else 
        {
            if ( [self.directory isEqualToString:@"a directory"] ) {
                /*  child.path is the file, so put it into an array  */                                                                                          
            }
        }
    }
}

不像将数组加载到 UITableView 中,就像任何其他 NSArray / NSMutableArray 一样

Get the contents of a directory and put them into an array.

- (void)restClient:(DBRestClient*)client loadedMetadata:(DBMetadata*)metadata 
{
    for (DBMetadata* child in metadata.contents) 
    {
        if (child.isDirectory)
        {
            [self.restClient loadMetadata:child.path withHash:hash];
        } 
        else 
        {
            if ( [self.directory isEqualToString:@"a directory"] ) {
                /*  child.path is the file, so put it into an array  */                                                                                          
            }
        }
    }
}

Than load your array into your UITableView as you would any other NSArray / NSMutableArray

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文