2012-12-04 45 views
0

我正在使用Facebook sdk上傳視頻,但我無法在Facebook上上傳超過60MB的視頻。我嘗試了很多使用NSInputStream還可以用來傳送數據和所有: -如何在iOS的Facebook上發佈大型視頻?

NSString *filePath = [[NSBundle mainBundle] pathForResource:@"sample" ofType:@"mov"]; 
    NSData *videoData = [NSData dataWithContentsOfFile:filePath]; 
    NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys: 
            videoData, @"video.mov", 
            @"video/quicktime", @"contentType", 
            @"Video Test Title", @"title", 
            @"Video Test Description", @"description", 
            nil]; 

    FBRequest *request = [FBRequest requestWithGraphPath:@"me/videos" parameters:params HTTPMethod:@"POST"]; 

    [request startWithCompletionHandler:^(FBRequestConnection *connection, id result, NSError *error) { 
     NSLog(@"result: %@, error: %@", result, error); 
    }]; 
+0

我有工作了很多這樣的: - 我佩服誰解決了我的問題 – Maheep

+1

您可以發佈''錯誤和'結果'? – ender

+0

給我視頻尺寸? – Rushabh

回答

4

使用dataWithContentsOfFile:選項來代替。不嘗試加載所有的數據到內存中,這可能使您的應用程序通過iOS的封閉得到:

NSData *videoData = [NSData dataWithContentsOfFile:video.localURL options:NSDataReadingMappedAlways error:&error];