- (void)uploadTicket:(GDataServiceTicket *)ticket
finishedWithEntry:(GDataEntryYouTubeVideo *)videoEntry
error:(NSError *)error
{
NSLog(@"ticket");
UIButton *uploadButton = (UIButton *)[backgroundImage viewWithTag:10];
UIButton *cancleButton = (UIButton *)[backgroundImage viewWithTag:20];
if (error == nil)
{
// tell the user that the add worked
NSLog(@"Video Successfully Uploaded to Youtube");
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
NSNumber *uploadedToYouTube = [defaults objectForKey:@"uploadedToYouTube"];
if(nil == uploadedToYouTube)
{
[defaults setObject:[NSNumber numberWithBool:YES] forKey:@"uploadedToYouTube"];
[defaults synchronize];
}
NSNumber *userOpenedYoutubeView = [defaults objectForKey:@"userOpenedYoutubeToUnlockTheme"];
if(nil != userOpenedYoutubeView)
{
// [defaults setBool:NO forKey:@"Unlock_Theme"];
[defaults setObject:[NSNumber numberWithBool:NO] forKey:@"Unlock_Theme"];
[defaults synchronize];
UIAlertView *alrtView = [[UIAlertView alloc] initWithTitle:@"Congrats...!" message:@"Your new theme is Unlocked" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];
[alrtView show];
[alrtView release];
[self removeFromSuperview];
}
else
{
UIAlertView *alrtView = [[UIAlertView alloc] initWithTitle:@"Success...!" message:@"Your Video is successfully uploaded to Youtube" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];
[alrtView show];
[alrtView release];
[self removeFromSuperview];
}
}
else {
NSLog(@"Fails to upload Video to Youtube");
UIAlertView *alrtView = [[UIAlertView alloc] initWithTitle:@"Sorry" message:@"Fails to upload video to Youtube. Please try again" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];
[alrtView show];
[alrtView release];
}
mProgressView . hidden = YES;
uploadButton . hidden = NO;
cancleButton . enabled = YES;
[mProgressView setProgress: 0.0];
[self setUploadTicket:nil];
}
每次我尝试上传时都会显示警告消息“上传失败”。我不明白为什么会这样表现出来。在升级到Xcode 7之前,它工作正常。任何人都知道请帮助我。