OneDrive SDK iOS中任何文件的StreamablePath

时间:2018-10-23 12:55:16

标签: ios onedrive

我正在使用OneDriveSDK for iOS。我找不到任何文件的流路径。

1 个答案:

答案 0 :(得分:1)

 dispatch_semaphore_t sema = dispatch_semaphore_create(0);
    __block NSString *streamablePath = @"";
    ODClient *client = [ODClient loadCurrentClient];
    ODItemRequest *request = [[[client drive] items:item.path] request];
    [request getWithCompletion:^(ODItem *response, NSError *error) {
        if (!error)
        {
            streamablePath = [[response dictionaryFromItem] objectForKey:@"@content.downloadUrl"];
            dispatch_semaphore_signal(sema);
        }
    }];

    dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER);
    return streamablePath;