chodzi o G + docs tutaj: https://developers.google.com/+/mobile/ios/sign-inGoogle+ SDK dla iOS przycisk Dodaj signin programowo
Znak w przycisk może być dodany używając XIB lub programowo w UIViewController.
Mam TableViewController i mam zamiar dodać przycisk G + signin jako akcesorium widzenia wierszu tabeli:
subtitleCell.accessoryView = self.googlePlusSignInButton;
gdzie przycisk signin zostanie zainicjowany w następujący sposób:
-(void) setGooglePlusButtons {
self.googlePlusSignInButton = [[UIButton buttonWithType:UIButtonTypeCustom] retain];
UIImage *backgroundButtonImage = [UIImage imageNamed:@"bt_search_cancel.png"];
googlePlusSignInButton_.frame = CGRectMake(0.0f,
0.0f,
backgroundButtonImage.size.width,
backgroundButtonImage.size.height);
googlePlusSignInButton_.titleLabel.textColor = [UIColor whiteColor];
googlePlusSignInButton_.titleLabel.font = [UIFont boldSystemFontOfSize:11.0f];
googlePlusSignInButton_.titleLabel.numberOfLines = 2;
googlePlusSignInButton_.titleLabel.shadowColor = [UIColor darkGrayColor];
googlePlusSignInButton_.titleLabel.shadowOffset = CGSizeMake(0.0f,
-1.0f);
[googlePlusSignInButton_ setTitle:NSLocalizedString(@"UI_BUTTONS_LOGIN", @"")
forState:UIControlStateNormal];
[googlePlusSignInButton_ setBackgroundImage:backgroundButtonImage
forState:UIControlStateNormal];
// Make sure the GPPSignInButton class is linked in because references from
// xib file doesn't count.
[GPPSignInButton class];
GPPSignIn *signIn = [GPPSignIn sharedInstance];
signIn.delegate = self;
signIn.shouldFetchGoogleUserEmail = signIn.shouldFetchGoogleUserEmail;
signIn.actions = [NSArray arrayWithObjects:
@"http://schemas.google.com/ListenActivity",
nil];
}
przycisk jest ustawiony na viewDidLoad:
- (void)viewDidLoad {
[super viewDidLoad];
[self setGooglePlusButtons];
//...
UIViewControll ed posiada interfejs dla delegata signin:
@interface MXMSettingsTableViewController() <GPPSignInDelegate>
@end
Wydaje się, że pełnomocnik nie jest nazywany lub udostępniony znak w przycisk nie jest powiązany z instancji kontrolera:
// GPPSignInDelegate
- (void)finishedWithAuth:(GTMOAuth2Authentication *)auth
error:(NSError *)error {
///....
}
zakładam że
// Make sure the GPPSignInButton class is linked in because references from
// xib file doesn't count.
[GPPSignInButton class];
jest łączący przycisk wystąpienia ViewController:
// The button that handles Google+ sign-in.
@property (retain, nonatomic) GPPSignInButton *googlePlusSignInButton;
ale jest coś złego w tej implementacji, którego nie mogę wymyślić.
Tak, oczywiście !!!W ten sposób mogłem także oddzielić ten widok od obiektu "kontroler", który obsługuje konto G + i loginu (gdzie tutaj brakuje integracji kClient Id). Wielkie dzięki! – loretoparisi
Dziwna rzecz. Aplikacja GooglePlus otwiera się, ale nie jest wykonywane uwierzytelnianie ani aplikacja openURL: (NSURL *) url sourceApplication: jest wywoływana. Identyfikator klienta jest poprawnie skonfigurowany w konsoli programisty. – loretoparisi
Czy dodałeś typ adresu URL? Oto krok 4 tego przewodnika: https://developers.google.com/+/mobile/ios/getting-started – Lefteris