Search code examples
iosonedrive

StreamablePath for any file in One Drive SDK iOS


I am using OneDriveSDK for iOS . I am unable to find streamable Path for any file.


Solution

  •  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;