I have an application that uploads video files to youtube. The problem I have is that if a user that wants to upload a video file to youtube, has several channels on youtube, my login flow doesn't show a list in which the user can select the correct channel. For example this is what Google's app, Capture, shows when I login with an account which has two identities:
When my app uses the same account I do not see a list of channels.
This is the code I use to login to youtube:
NSString *scope = [GDataServiceGoogleYouTube authorizationScope];
SEL finishedSel = #selector(viewController:finishedWithAuth:error:);
GTMOAuth2ViewControllerTouch *viewController;
viewController = [GTMOAuth2ViewControllerTouch controllerWithScope:scope
clientID:g_clientID
clientSecret:g_clientSecret
keychainItemName:g_keychainItemName
delegate:self
finishedSelector:finishedSel];
UINavigationController *aNavController = [[UINavigationController alloc] initWithRootViewController:viewController];
[self presentModalViewController:aNavController animated:YES];
[aNavController release];
So what do I need to do to show this list of channels?
So I managed to fix the problem.
To see a list of a user's youtube channels, you must use the latest version of google's objective-c library at http://code.google.com/p/google-api-objectivec-client/.
Also when you are authorizing you must use kGTLAuthScopeYouTube authorization scope, like so:
GTMOAuth2ViewControllerTouch *viewController;
viewController = [GTMOAuth2ViewControllerTouch controllerWithScope:kGTLAuthScopeYouTube
clientID:g_clientID
clientSecret:g_clientSecret
keychainItemName:g_keychainItemName
delegate:self
finishedSelector:finishedSel];
UINavigationController *aNavController = [[UINavigationController alloc] initWithRootViewController:viewController];
[self presentModalViewController:aNavController animated:YES];
[aNavController release];
Related
I am developing an iPad application using sdk 5 and storyboard. I´m following the [OAuth2] Tutorial and sample.1
I have port the code to a Singleton. Create a new view everytime initSesion is called:
viewController = [[GTMOAuth2ViewControllerTouch alloc] initWithScope:scope
clientID:kMyClientID
clientSecret:kMyClientSecret
keychainItemName:kKeychainItemName
delegate:self
finishedSelector:#selector(viewController:finishedWithAuth:error:)];
//viewController.keychainItemAccessibility = kSecAttrAccessibleAlways;
NSDictionary *params = [NSDictionary dictionaryWithObject:#"en"
forKey:#"hl"];
//viewController.signIn.additionalAuthorizationParameters = params;
NSString *html = #"<html><body bgcolor=silver><div align=center>Loading sign-in page...</div></body></html>";
viewController.initialHTMLString = html;
[[self navigationController] pushViewController:viewController
animated:YES];
But, when another Viewcontroller call the simgleton, the view pushed is not display.
Teorically, a navigator Controller use a stack to show differents view, so, if i´m in the correct way, that function must launch the GTMOAuth2ViewControllerTouch.view, to log in using OAuth2, thats occur in the sample. But nothing happen.
What´s going on? Thanks in advance.
Check if you have a navigation controller, it could be nil. Use debug mode or put a NSLog:
if(![self navigationController]){ NSLog(#"I´m Nil"); } else { ... }
If you have no created a navigationController, try use the singleton of the app to get it, something like:
[[[[[UIApplication sharedApplication] delegate] window] rootViewController] presentModalViewController:viewController animated:YES];
Im using parse.com login controller to log users into facebook.
if user authorized the app before he gets 'you already authorized this app' from facebook.
anyone know how it can be solved ?
the code Im using:
PFLogInViewController *logInController = [[PFLogInViewController alloc] init];
logInController.delegate = self;
logInController.fields = PFLogInFieldsFacebook ;
logInController.facebookPermissions = [NSArray arrayWithObjects:#"publish_stream", nil];
NSLog(#"%#",logInController.facebookPermissions);
[self.navigationController presentModalViewController:logInController animated:YES];
I suspect you are showing the view unnecessarily. Try only presenting the PFLogInViewController if [PFUser currentUser] returns nil.
Thomas is right. In addition, your navigationController should not be presenting the modal. self should be.
I am using EGOPhotoViewer to load up a bunch of images from the web. They are shown in thumbnails first, so when a user clicks on one of the thumbs, I want to show that image in the EGOPhotoViewer first. So, if I clicked the 5th image, it would load the image viewer starting at 5 of 20 or whatever.
Is there a way to do this?
ZSPhoto *photo;
for (Asset *a in items) {
photo = [[ZSPhoto alloc] initWithImageURL:[NSURL URLWithString:a.imgURL] name:a.caption];
[photos addObject:photo];
[photo release];
}
// Photosource
ZSPhotoSource *photoSource = [[ZSPhotoSource alloc] initWithPhotos:[NSArray arrayWithArray:photos]];
EGOPhotoViewController *photoController = [[EGOPhotoViewController alloc] initWithPhotoSource:photoSource];
// Set starting photo index here?
UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:photoController];
navController.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
navController.modalPresentationStyle = UIModalPresentationFullScreen;
[self presentModalViewController:navController animated:YES];
[navController release];
[photoController release];
I was running into the same problem, What I was doing was trying to moveToPhotoAtIndex: before pushing it to the navigationController. You need to do it after.
here is how i got it to work for my application...
// gets indexPath from tableView
-(void)showSelectedPhoto:(NSIndexPath *)indexPath{
// Already had photoControllerView declared in header, init with your photo source
photoControllerView = [[EGOPhotoViewController alloc] initWithPhotoSource:source];
// pushed the photoControllerView to the navigation controller
[self.navigationController pushViewController:photoController animated:YES];
// THEN you moveToPhotoAtIndex and it should work correctly!
[photoController moveToPhotoAtIndex:indexPath.row animated:NO];
}
Hope this helps clarify things!
There is a method moveToPhotoAtIndex:animated: that you should be able to use.
i am using same process to load the images in image viewer. and app is working fine for me..you can get the code from here
selected image wouldnt load in ego image viewer in ios 7
hope you will get help.
I am creating an iPhone app for iOS 4 using the newest SDK.
On one of my pages I would like the user to click a thumbnail of a photo and then a partial curl transition style take affect to show a full sized version of the image.
On the page with the full sized image I have a toolbar with a "Back" button and a "Select" button.
When I click the Back button the partial curls rolls back down to my first Xib.
BUT when I click the Select button, the app crashes.
Can anyone help me or explain why it is doing this? Thanks!
.m file:
-(IBAction)switchViews4 {
ImagePicker *image = [[ImagePicker alloc] initWithNibName:nil bundle:nil];
image.modalTransitionStyle = UIModalTransitionStylePartialCurl;
[self presentModalViewController:image animated:YES];
[image release];
}
Without seeing any other code, it is difficult to know why. But one guess is that you have a reference counting problem. Try:
-(IBAction)switchViews4 {
ImagePicker *image = [[[ImagePicker alloc] initWithNibName:nil bundle:nil] autorelease];
image.modalTransitionStyle = UIModalTransitionStylePartialCurl;
[self presentModalViewController:image animated:YES];
}
and see if it helps.
My app requires one set of tabs on the initial view, the last tab item is reserved for an in-app purchase once the user selects. However, once the user makes the in-app purchase I would like a new set of tabs to appear. I would like for the user to be able to switch back and forward between the free part of the app and the in-app purchase part of the app with different tab bars. For example:
"TabBar1" to have "TabItem 1", "TabItem 2", "TabItem 3", and "TabItem 4" for my Free App, when user selects "TabItem 4" ...a welcome or in-app purchase screen will appear. If user makes the in-app purchase, "TabBar2" appears with "TabItem 1", "TabItem 5", "TabItem 6", and "TabItem4". "TabItem1" will bring you back to Free part of app and "TabBar1" when selected again. Hope I didnt confuse...How do you accomplish this? Thanks for the help.
I forgot to add that this Tabbar is to be combined with a Navigation controller as well.
you can change the views of root tabbarcontroller anytime you want, also you can change tabbaritems title & icons. Here's an example:
MyAppDelegate *appController = (MyAppDelegate *)[[UIApplication sharedApplication] delegate];
// Setting 1st tab + view + icon
ViewController1 *viewController1 = [[ViewController1 alloc] initWithNibName:#"ViewController1" bundle:nil];
favoritesController.title = #"Tab1 Title";
UINavigationController *navigationTab1Controller = [[[UINavigationController alloc] initWithRootViewController: viewController1] autorelease];
UITabBarItem *anItem = [[[UITabBarItem alloc] initWithTabBarSystemItem:UITabBarSystemItemFavorites tag:0] autorelease];
navigationTab1Controller.tabBarItem = anItem;
// Setting 2st tab + view + icon
ViewController2 *viewController2 = [[ViewController2 alloc] initWithNibName:#"ViewController2" bundle:nil];
searchController.title = #"Tab2 Title";
UINavigationController *navigationTab2Controller = [[[UINavigationController alloc] initWithRootViewController:searchController] autorelease];
UITabBarItem *anItem1 = [[[UITabBarItem alloc] initWithTabBarSystemItem:UITabBarSystemItemSearch tag:1] autorelease];
navigationTab2Controller.tabBarItem = anItem1;
// Now setting the array of tab views, each one attached to its navigation controller
NSArray *array = [[NSArray alloc] initWithObjects:self.navigationController, navigationTab1Controller, navigationTab2Controller, nil];
[appController.tabBarController setViewControllers:array animated:NO];
appController.tabBarController.selectedViewController = self.navigationController;
UITabBarItem *anItem2 = [[[UITabBarItem alloc] initWithTitle:#"Tab3 Title" image:[appController thumbnailImage:#"image"] tag:2] autorelease];
self.navigationController.tabBarItem = anItem2;
I'm changing the set of views and tabs, depending of the state of my application. Hopefully it helps
EDIT: function thumbnailImage is a function I wrote for caching images and avoid memory leaks, you can use imageNamed instead or other technique that retrieves an image from a bundle.
While this might be possible, I would highly suggest against it from a User Experience perspective. Swapping a core piece of the navigational UI out from under the users nose is bound to confuse some users and it not really needed in this situation.
There are plenty of other ways to give feedback to the user, and plenty of ways to handle in-app purchases and I highly recommend doing some mockups of methods that could not potentially confuse the user.