Youtube video upload ussue
Youtube video upload ussue
- Subject: Youtube video upload ussue
- From: Damien Cooke <email@hidden>
- Date: Sat, 13 Feb 2010 11:44:05 +1030
Hi All,
I have got a very frustrating problem. I am trying to upload video to youtube using GData APIs and am having significant issues. I am sure one of you will have done this previously and I hope you can assist me.
I have copied the cocoa sample and just put it in my code to get something working I can customise it later. When this code executes it fails with the following error
*** Assertion failure in -[GDataServiceBase fetchObjectWithURL:objectClass:objectToPost:ETag:httpMethod:delegate:didFinishSelector:completionHandler:retryInvocationValue:ticket:](),
/Users/damien/damien/projects/google/gdata-objectivec-client-read-only/Source/BaseClasses/GDataServiceBase.m:559
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'GDataHTTPUploadFetcher needed'
Ok so I go to the source of the assertion failure
//
// now that we have all the request header info ready,
// create and set up the fetcher for this request
//
GDataHTTPFetcher* fetcher = nil;
if (isUploadingDataChunked) {
// hang on to the user's requested chunk size, and ensure it's not tiny
NSUInteger uploadChunkSize = [self serviceUploadChunkSize];
if (uploadChunkSize < kMinimumUploadChunkSize) {
uploadChunkSize = kMinimumUploadChunkSize;
}
Class uploadClass = NSClassFromString(@"GDataHTTPUploadFetcher");
GDATA_ASSERT(uploadClass != nil, @"GDataHTTPUploadFetcher needed");
NSString *uploadMIMEType = [objectToPost uploadMIMEType];
fetcher = [uploadClass uploadFetcherWithRequest:request
uploadData:uploadData
uploadMIMEType:uploadMIMEType
chunkSize:uploadChunkSize];
} else {
fetcher = [GDataHTTPFetcher httpFetcherWithRequest:request];
}
So it appears the Class uploadClass = NSClassFromString(@"GDataHTTPUploadFetcher"); line fails. This tells me that there is no instance of the GDataHTTPUploadFetcher class at this time.
Ok so what did I miss in my method I can not find any definition of a GDataHTTPUploadFetcher in the sample project.
I have provided my method below hoping someone can assist me by comparing mine to theirs and showing me where I have gone wrong. I really appreciate your assistance.
here is a stack trace also
Thread 0 Crashed: Dispatch queue: com.apple.main-thread
0 CoreFoundation 0x028bfde4 ___TERMINATING_DUE_TO_UNCAUGHT_EXCEPTION___ + 4
1 libobjc.A.dylib 0x93f5e509 objc_exception_throw + 56
2 CoreFoundation 0x0288001b +[NSException raise:format:arguments:] + 155
3 Foundation 0x00265ef5 -[NSAssertionHandler handleFailureInFunction:file:lineNumber:description:] + 101
4 eca 0x00029b13 -[GDataServiceBase fetchObjectWithURL:objectClass:objectToPost:ETag:httpMethod:delegate:didFinishSelector:completionHandler:retryInvocationValue:ticket:] + 2205 (GDataServiceBase.m:561)
5 CoreFoundation 0x0283e87d __invoking___ + 29
6 CoreFoundation 0x0283e768 -[NSInvocation invoke] + 136
7 eca 0x0002e7a7 -[GDataServiceGoogle authFetcher:finishedWithData:] + 552 (GDataServiceGoogle.m:249)
8 eca 0x00014816 -[GDataHTTPFetcher connectionDidFinishLoading:] + 651 (GDataHTTPFetcher.m:894)
9 Foundation 0x0020e524 -[NSURLConnection(NSURLConnectionReallyInternal) sendDidFinishLoading] + 84
10 Foundation 0x0020e493 _NSURLConnectionDidFinishLoading + 147
11 CFNetwork 0x02be0e19 URLConnectionClient::_clientDidFinishLoading(URLConnectionClient::ClientConnectionEventQueue*) + 197
12 CFNetwork 0x02c541b2 URLConnectionClient::ClientConnectionEventQueue::processAllEventsAndConsumePayload(XConnectionEventInfo<XClientEvent, XClientEventParams>*, long) + 306
13 CFNetwork 0x02c5447c URLConnectionClient::ClientConnectionEventQueue::processAllEventsAndConsumePayload(XConnectionEventInfo<XClientEvent, XClientEventParams>*, long) + 1020
14 CFNetwork 0x02c5447c URLConnectionClient::ClientConnectionEventQueue::processAllEventsAndConsumePayload(XConnectionEventInfo<XClientEvent, XClientEventParams>*, long) + 1020
15 CFNetwork 0x02bd4f24 URLConnectionClient::processEvents() + 94
16 CFNetwork 0x02bd4dae MultiplexerSource::perform() + 238
17 CoreFoundation 0x0280fd9a CFRunLoopRunSpecific + 3402
18 CoreFoundation 0x0280f048 CFRunLoopRunInMode + 88
19 GraphicsServices 0x02f539f1 GSEventRunModal + 217
20 GraphicsServices 0x02f53ab6 GSEventRun + 115
21 UIKit 0x00468a98 UIApplicationMain + 1134
22 eca 0x000022a8 main + 102 (main.m:14)
23 eca 0x00002216 start + 54
- (int)uploadToService:(NSData *)movieData ofType:(NSString *)dataType withContentName:(NSString *)movieName
{
NSString *devKey = [self developerKey];
GDataServiceGoogleYouTube *service = [self youTubeService];
[service setYouTubeDeveloperKey:devKey];
NSURL *url = [GDataServiceGoogleYouTube youTubeUploadURLForUserID:[self userName] clientID:@""];
// load the file data
NSData *data = [NSData dataWithData: movieData];
NSString *filename = contentName;
// gather all the metadata needed for the mediaGroup
NSString *titleStr = @"Test";
GDataMediaTitle *title = [GDataMediaTitle textConstructWithString:titleStr];
NSString *categoryStr = @"";
GDataMediaCategory *category = [GDataMediaCategory mediaCategoryWithString:categoryStr];
[category setScheme:kGDataSchemeYouTubeCategory];
NSString *descStr = @"Test";
GDataMediaDescription *desc = [GDataMediaDescription textConstructWithString:descStr];
NSString *keywordsStr = @"Test";
GDataMediaKeywords *keywords = [GDataMediaKeywords keywordsWithString:keywordsStr];
BOOL isPrivate = YES;
GDataYouTubeMediaGroup *mediaGroup = [GDataYouTubeMediaGroup mediaGroup];
[mediaGroup setMediaTitle:title];
[mediaGroup setMediaDescription:desc];
[mediaGroup addMediaCategory:category];
[mediaGroup setMediaKeywords:keywords];
[mediaGroup setIsPrivate:isPrivate];
NSString *mimeType = @"video/quicktime";//[GDataUtilities MIMETypeForFileAtPath:path defaultMIMEType:@"video/quicktime"];
// create the upload entry with the mediaGroup and the file data
GDataEntryYouTubeUpload *entry = [GDataEntryYouTubeUpload uploadEntryWithMediaGroup:mediaGroup data:data MIMEType:mimeType slug:filename];
SEL progressSel = @selector(ticket:hasDeliveredByteCount:ofTotalByteCount:);
[service setServiceUploadProgressSelector:progressSel];
GDataServiceTicket *ticket = [service fetchEntryByInsertingEntry:entry forFeedURL:url delegate:self didFinishSelector:@selector(uploadTicket:finishedWithEntry:error:)];
[self setUploadTicket:ticket];
return 0;
}
Best regards
Damien
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden