在我的應用程序中,我試圖上傳使用FbConnect在Facebook牆上的視頻我的代碼看起來oky但我不知道爲什麼我的視頻沒有上傳如果我使用相同的代碼方法上傳圖像它成功上傳圖像在臉書上。這裏是我的代碼,我使用的圖片上傳如何使用FBConncet在Facebook上上傳視頻?
NSString *filePath = [[NSBundle mainBundle] pathForResource:@"2" ofType:@"png"];
NSURL *url = [NSURL URLWithString:path];
NSData *data = [NSData dataWithContentsOfFile:filePath];
UIImage *img = [[UIImage alloc] initWithData:data];
NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
img, @"Picture",
nil];
[_facebook requestWithGraphPath:@"me/photos"
andParams:params
andHttpMethod:@"POST"
andDelegate:self];
[img release];
和用於視頻我試圖此代碼,以便爲
NSString *filePath = [[NSBundle mainBundle] pathForResource:@"myVideo" ofType:@"mp4"];
NSURL *url = [NSURL URLWithString:filePath];
NSData *videoData = [NSData dataWithContentsOfURL:url];
NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
videoData, @"video.mp4",
@"video/quicktime", @"contentType",
@"Video Test Title", @"title",
@"Video Test Description", @"description",
nil];
[_facebook requestWithGraphPath:@"me/videos"
andParams:params
andHttpMethod:@"POST"
andDelegate:self];
上面的代碼給我沒有錯誤,但它retun在標籤的一些文字信息(操作無法完成)。這不是圖像上傳的情況。所以可以引導我如何解決它。由於
Sahil告訴我一件事,我可以修復現有的代碼,因爲當我用它的圖像相同的代碼作品。 – NSCool
@lena閱讀oAuth2Test fb完整教程.. – Bajaj
謝謝讓我檢查它 – NSCool