Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
iOS App with YouTube Uploading Error
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  7 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Marcos Jesús Vivar  
View profile  
 More options Apr 25 2011, 1:12 pm
From: Marcos Jesús Vivar <marcosjvi...@gmail.com>
Date: Mon, 25 Apr 2011 14:12:55 -0300
Local: Mon, Apr 25 2011 1:12 pm
Subject: iOS App with YouTube Uploading Error

Hi everyone,

I'm writing a small iOS App that should upload a video to a YouTube user's account.

I've used the YouTube desktop example and adapted it to the iOS available objects.
The app actually compiles and behaves properly. However when I get to the point of UPLOADING the video, it throws me the same error over and over again:

serviceBase:<GDataServiceGoogleYouTube: 0x783de30> objectFetcher:<GDataHTTPUploadFetcher: 0x78520b0> failedWithStatus:400 data:<errors xmlns='http://schemas.google.com/g/2005'><error><domain>GData</domain><code>InvalidRequestUriException</code><inter nalReason>Missing or invalid username.</internalReason></error></errors>

When I call the method that instantiates the GDataEntryYouTubeUpload,
- (IBAction)uploadClicked:(id)sender

everything seems to work fine and perfectly settled.

Any thoughts would be appreciated.

Marcos Jesús Vivar
iOS Developer

Twitter | LinkedIn | Tumblr


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Greg Robbins  
View profile  
 More options Apr 25 2011, 2:43 pm
From: Greg Robbins <grobb...@google.com>
Date: Mon, 25 Apr 2011 11:43:03 -0700
Local: Mon, Apr 25 2011 2:43 pm
Subject: Re: iOS App with YouTube Uploading Error

There's no relevant code snippet or http request/response log in your
message, but my first guess is that the service object being used to insert
the entry for upload does not have the user credentials (email and password)
set.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Marcos Jesús Vivar  
View profile  
 More options Apr 25 2011, 3:02 pm
From: Marcos Jesús Vivar <marcosjvi...@gmail.com>
Date: Mon, 25 Apr 2011 16:02:01 -0300
Local: Mon, Apr 25 2011 3:02 pm
Subject: Re: iOS App with YouTube Uploading Error

Hi Greg,

This is how I modified the GDataServiceGoogleYouTube constructor:
- (GDataServiceGoogleYouTube *)youTubeService
{
static GDataServiceGoogleYouTube* service = nil;

if (!service)
 { service = [[GDataServiceGoogleYouTube alloc] init];

 [service setShouldCacheDatedData:YES];
 [service setServiceShouldFollowNextLinks:YES];
 [service setIsServiceRetryEnabled:YES];

}

NSString *username = [kYoutubeUsername retain];
NSCharacterSet *whitespace = [NSCharacterSet whitespaceAndNewlineCharacterSet];
kYoutubeUsername = [username stringByTrimmingCharactersInSet:whitespace];

if ([kYoutubeUsername rangeOfString:@"@"].location == NSNotFound)
{ kYoutubeUsername = [kYoutubeUsername stringByAppendingString:@"@gmail.com"]; }

if (([kYoutubeUsername length] > 0) && ([kYoutubePassword length] > 0))
 { [service setUserCredentialsWithUsername:[kYoutubeUsername retain] password:[kYoutubePassword retain]]; }
else
 { [service setUserCredentialsWithUsername:nil password:nil]; }

 [service setYouTubeDeveloperKey:DEVELOPER_KEY];

return service;

}

And the (NSString *) objects "kYoutubeUsername" and "kYoutubePassword" are set as:

kYoutubeUsername = mUsernameField.text;
kYoutubePassword = mPasswordField.text;

This is done in another method, prior to showing the UITextFields with required GDataYouTubeMediaGroup fields such as: Title, Description, Category, Keywords, and if it's a private entry or not.

This is the actual definition of "kYoutubeUsername" and "kYoutubePassword":

@interface YoutubeController : UIViewController
{
/*.
. Other definitions
.*/

NSString *kYoutubeUsername;
NSString *kYoutubePassword;

}

I tried to look at the obvious reasons why this might not work out but it seems that I'm missing something of a sneaky nature.

With this further information, What would be your second guess?

Thanks in advance!
Marcos Jesús Vivar
iOS Developer

Twitter | LinkedIn | Tumblr


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Greg Robbins  
View profile  
 More options Apr 25 2011, 4:37 pm
From: Greg Robbins <grobb...@google.com>
Date: Mon, 25 Apr 2011 13:37:36 -0700
Local: Mon, Apr 25 2011 4:37 pm
Subject: Re: iOS App with YouTube Uploading Error

Have you looked at the value of the username and password variables in the
debugger at the point where setUserCredentialsWithUsername:password: is
called?

Incidentally, the Cocoa convention is that the receiving methods retains or
copies its parameters if necessary, so the caller never needs to retain
them.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Marcos Jesús Vivar  
View profile  
 More options Apr 25 2011, 5:22 pm
From: Marcos Jesús Vivar <marcosjvi...@gmail.com>
Date: Mon, 25 Apr 2011 18:22:05 -0300
Local: Mon, Apr 25 2011 5:22 pm
Subject: Re: iOS App with YouTube Uploading Error

Yes,

I have looked at those values several times (including NSLogging them) and they are perfectly set.

I wonder what it's the main difference with the exampled code for YouTube:

- (IBAction)uploadClicked:(id)sender
{
 [mUploadProgressView setHidden:NO];

GDataServiceGoogleYouTube *service = [self youTubeService];
 [service setYouTubeDeveloperKey:DEVELOPER_KEY];

NSString *username = kYoutubeUsername;

NSURL *url = [GDataServiceGoogleYouTube youTubeUploadURLForUserID:username];

// load the file data
NSString *filePath = [[NSBundle mainBundle] pathForResource:@"100_1142" ofType:@"mov"];

NSData *data = [NSData dataWithContentsOfFile:filePath];
NSString *filename = [filePath lastPathComponent];

// gather all the metadata needed for the mediaGroup
NSString *titleStr = mTitleField.text;
GDataMediaTitle *title = [GDataMediaTitle textConstructWithString:titleStr];

GDataMediaCategory *category = [GDataMediaCategory mediaCategoryWithString:@"Entertainment"];
 [category setScheme:kGDataSchemeYouTubeCategory];

NSString *descStr = mDescriptionField.text;
GDataMediaDescription *desc = [GDataMediaDescription textConstructWithString:descStr];

NSString *keywordsStr = mKeywordsField.text;
GDataMediaKeywords *keywords = [GDataMediaKeywords keywordsWithString:keywordsStr];

BOOL isPrivate = ([mPrivateSwitch state] == YES);

GDataYouTubeMediaGroup *mediaGroup = [GDataYouTubeMediaGroup mediaGroup];
 [mediaGroup setMediaTitle:title];
 [mediaGroup setMediaDescription:desc];
 [mediaGroup addMediaCategory:category];
 [mediaGroup setMediaKeywords:keywords];
 [mediaGroup setIsPrivate:isPrivate];

NSString *mimeType = [GDataUtilities MIMETypeForFileAtPath:filePath
defaultMIMEType:@"video/mov"];

// 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;
 ticket = [service fetchEntryByInsertingEntry:entry
forFeedURL:url
delegate:self
didFinishSelector:@selector(uploadTicket:finishedWithEntry:error:)];

 [self setUploadTicket:ticket];

 [self updateUI];

}

Since we're developing we have hardcoded the category (an existing one) and the video file (added to the project) as you can see.

Any idea that the group may have is going to be kindly received!

Thanks in advance!

Marcos Jesús Vivar
iOS Developer

Twitter | LinkedIn | Tumblr


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Greg Robbins  
View profile  
 More options Apr 25 2011, 5:28 pm
From: Greg Robbins <grobb...@google.com>
Date: Mon, 25 Apr 2011 14:28:11 -0700
Local: Mon, Apr 25 2011 5:28 pm
Subject: Re: iOS App with YouTube Uploading Error

Use kGDataServiceDefaultUser for the username when constructing the upload
URL.

Try turning on logging with [GDataHTTPFetcher setIsLoggingEnabled:YES] and
looking at the request/response that is failing in the logs.

The error "Missing or invalid username" implies something fundamental is
wrong, either with the Authentication header of the upload request, or with
the upload URL.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
MOHIT MASKE  
View profile  
 More options Sep 8 2012, 3:56 am
From: MOHIT MASKE <maskemohi...@gmail.com>
Date: Sat, 8 Sep 2012 00:56:36 -0700 (PDT)
Local: Sat, Sep 8 2012 3:56 am
Subject: Re: iOS App with YouTube Uploading Error

Hi everyone,

> I'm writing a small iOS App that should upload a video to a YouTube user's
> account.

>    I'am added file gdata in my video sense app file so some error will be

created..


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »