我有一個iOS應用通過gdata和YouTube API獲取用戶的所有視頻。我的問題伴隨着私人視頻,我需要這樣做才能在視頻被選定時公開私人視頻。如何使用Gdata for iOS更改視頻從私有公開YouTube API應用
由於某種原因,每當我嘗試製作視頻時,我都無法對其進行編輯,因爲YouTube API返回的條目的editLink
爲空。
這裏是我的代碼,有人能告訴我什麼,我做錯了或者我能做些什麼,以使更改:
GDataEntryBase *entry = [[feed entries] objectAtIndex:selectedRow];
[[(GDataEntryYouTubeVideo *)entry mediaGroup] setIsPrivate:NO];
//GDataEntryYouTubeUpload *uploadEntry =
//[GDataEntryYouTubeUpload uploadEntryWithMediaGroup:mediaGroup
//fileHandle:nil MIMEType:@"video/mp4" slug:[[entry title]
//stringValue]];
GDataServiceTicket *ticket;
GDataServiceGoogleYouTube *service = [self youTubeService];
NSString *str = [entry canEdit] ? @"YES" : @"NO";
NSLog(@"Can edit %@", str);
NSLog(@"Edit URL %@", [[entry editLink] URL]);
// NSURL *url = [GDataServiceGoogleYouTube
//youTubeUploadURLForUserID:kGDataServiceDefaultUser];
ticket = [service fetchEntryByUpdatingEntry:entry
forEntryURL:[[entry editLink] URL] delegate:self
didFinishSelector:@selector(uploadTicket:finishedWithEntry:error:)];
// ticket = [service fetchEntryByUpdatingEntry:entry
//delegate:self didFinishSelector:@selector(uploadTicket:finishedWithEntry:error:)];
NSLog(@"Ticket = %@", ticket);
}
}
- (void)uploadTicket:(GDataServiceTicket *)ticket
finishedWithEntry:(GDataEntryYouTubeVideo *)videoEntry error:(NSError
*)error {
NSLog(@"Finished...");
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Upload
failed" message:[NSString stringWithFormat:@"Upload failed: %@",
error] delegate:self cancelButtonTitle:@"Cancel"
otherButtonTitles:nil, nil];
if (error != nil) {
NSLog(@"Errors: %@", error);
[alert show];
} else {
NSLog(@"NO ERRORS :))");
}
}