IOS: Google+ button not working from XIB file?

I asked iOS: Log in using the Google button yesterday and are still struggling. The answer I received helped me understand that it GooglePlus.bundlewas imported incorrectly.

Now I am stuck on the part that the button that I created through XIBdoes not appear on the page.

What I've done?
I added a new button according to this gist and confirmed that everything is working fine. The code looks like

- (void)viewDidLoad {
    [super viewDidLoad];

    GPPSignInButton *button = [[GPPSignInButton alloc] init];
    [button setStyle:kGPPSignInButtonStyleWide];
    [self.view addSubview:button];

    GPPSignIn *signIn = [GPPSignIn sharedInstance];
    signIn.shouldFetchGooglePlusUser = YES;
    signIn.shouldFetchGoogleUserEmail = YES;


    [self.signInButton setStyle:kGPPSignInButtonStyleWide];


    signIn.clientID = kClientId;
    signIn.scopes = @[@"profile"];
    signIn.delegate = self;
//    [signIn trySilentAuthentication];

}

When I launched it, I see that enter image description here

So the button was added manually, but not the one I created using XIB. Mine XIBlooks like enter image description here

and the GooglePlusLoginViewController.hcode looks like

#import <UIKit/UIKit.h>
#import <GooglePlus/GooglePlus.h>

@class GPPSignInButton;

@interface GooglePlusLoginViewController : UIViewController <GPPSignInDelegate>
@property(weak, nonatomic) IBOutlet GPPSignInButton *signInButton;
@end

I want to know what mistake I am making, can someone notice this?

thank

+2
2

. , . , UIButton storyboard/xib, ViewController.h.

GPPSignInButton UIButton, .

.

Btw, , .

GPPSignInButton view.

viewDidLoad ViewController.m

GPPSignInButton *button = [[GPPSignInButton alloc] init];
[button setStyle:kGPPSignInButtonStyleWide];

CGRect frame = button.frame;
frame.origin.x = 50;
frame.origin.y = 190;
button.frame = frame;

[self.view addSubview:button];
+1

iOS, , , , ,

- (void)viewDidLoad {
    [super viewDidLoad];

    GPPSignInButton *button = [[GPPSignInButton alloc] init];
    [button setStyle:kGPPSignInButtonStyleWide];
    [self.signInButton addSubview:button];

    GPPSignIn *signIn = [GPPSignIn sharedInstance];
    signIn.shouldFetchGooglePlusUser = YES;
    signIn.shouldFetchGoogleUserEmail = YES;

    signIn.clientID = kClientId;
    signIn.scopes = @[@"profile"];
    signIn.delegate = self;
    [signIn trySilentAuthentication];

}

enter image description here

0

Source: https://habr.com/ru/post/1546558/


All Articles