Vimeo.com上传失败

时间:2013-05-22 20:30:11

标签: objective-c vimeo

要具备上传功能,我必须获得上传票证。但检查后看起来像无效。  在我创建新票后,我检查它并得到错误702.请帮助。我检查了参数,看起来很好。

    //vimeo.videos.upload.getTicket
    NSURL *ticketRequestURL = [NSURL URLWithString:@"http://vimeo.com/api/rest/v2?format=json&method=vimeo.videos.upload.getTicket"];
    NSMutableURLRequest *ticketRequest = [NSMutableURLRequest requestWithURL:ticketRequestURL];
    [ticketRequest setHTTPMethod:@"POST"];
    [auth authorizeRequest:ticketRequest];
    [NSURLConnection sendAsynchronousRequest:ticketRequest queue:[NSOperationQueue mainQueue] completionHandler:^(NSURLResponse *ticketRequestResponse, NSData *ticketRequestData, NSError *ticketRequestError) {
        NSString *ticketRequestResponseString = [[NSString alloc] initWithData:ticketRequestData encoding:NSStringEncodingConversionAllowLossy];
        NSDictionary *d = [[parser objectWithString:ticketRequestResponseString] objectForKey:@"ticket"];
        NSString *identifier = [d objectForKey:@"id"];

        //vimeo.videos.upload.checkTicket
        NSURL *ticketCheckRequestURL = [NSURL URLWithString:@"http://vimeo.com/api/rest/v2?format=json&method=vimeo.videos.upload.checkTicket"];
        NSMutableURLRequest *ticketCheckRequest = [NSMutableURLRequest requestWithURL:ticketCheckRequestURL];
        [ticketCheckRequest setHTTPMethod:@"POST"];
        [ticketCheckRequest setValue:identifier forHTTPHeaderField:@"ticket_id"];

        [auth authorizeRequest:ticketCheckRequest];
        [NSURLConnection sendAsynchronousRequest:ticketCheckRequest queue:[NSOperationQueue mainQueue] completionHandler:^(NSURLResponse *ticketRequestResponse, NSData *ticketRequestData, NSError *ticketRequestError) {
            NSString *ticketCheckRequestResponseString = [[NSString alloc] initWithData:ticketRequestData encoding:NSStringEncodingConversionAllowLossy];
            NSLog(@"%@", ticketCheckRequestResponseString);

        }];
    }];

1 个答案:

答案 0 :(得分:0)

嗯...在URL中指定ticket_id解决了我的问题。

NSURL *ticketCheckRequestURL = [NSURL URLWithString:[NSString stringWithFormat:@"http://vimeo.com/api/rest/v2?format=json&method=vimeo.videos.upload.checkTicket&ticket_id=%@", identifier]];