जोड़े जी + डॉक्स यहाँ के रूप में: https://developers.google.com/+/mobile/ios/sign-inगूगल + एसडीके प्रवेश बटन प्रोग्राम के रूप में
प्रवेश करें बटन को एक XIB या प्रोग्राम के रूप में एक UIViewController में का उपयोग कर जोड़ा जा सकता है।
मैं एक TableViewController है और मैं एक तालिका पंक्ति के गौण दृश्य के रूप में जी + प्रवेश बटन जोड़ने के लिए जा रहा हूँ:
subtitleCell.accessoryView = self.googlePlusSignInButton;
जहां साइन-इन बटन के रूप में प्रारंभ किया जा रहा है इस प्रकार है:
-(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];
}
बटन viewDidLoad में स्थापित किया गया है:
- (void)viewDidLoad {
[super viewDidLoad];
[self setGooglePlusButtons];
//...
UIViewControll एड साइन इन प्रतिनिधि के लिए एक इंटरफेस है:
@interface MXMSettingsTableViewController() <GPPSignInDelegate>
@end
ऐसा लगता है कि प्रतिनिधि नहीं बुलाया जा रहा है या बटन में साझा साइन नियंत्रक के उदाहरण से लिंक नहीं है:
// GPPSignInDelegate
- (void)finishedWithAuth:(GTMOAuth2Authentication *)auth
error:(NSError *)error {
///....
}
मुझे लगता है
: कि// Make sure the GPPSignInButton class is linked in because references from
// xib file doesn't count.
[GPPSignInButton class];
ViewController उदाहरण बटन लिंक हो रहा है 0
लेकिन इस कार्यान्वयन में कुछ गड़बड़ है जिसे मैं समझ नहीं सकता।
हां बिल्कुल !!!इस तरह से मैं इस दृश्य को "नियंत्रक" ऑब्जेक्ट से अलग करने में सक्षम था जो जी + खाता और लॉगिन (जहां के क्लाइंट आईडी आईडी एकीकरण गायब है) को संभाला जा रहा है। आपका बहुत बहुत धन्यवाद! – loretoparisi
अजीब चीज। GooglePlus ऐप खुलता है लेकिन कोई लेख नहीं किया जाता है और न ही एप्लिकेशन openURL: (NSURL *) url स्रोत एप्लिकेशन: कहा जा रहा है। क्लाइंट आईडी सही डेवलपर कंसोल पर कॉन्फ़िगर किया गया है। – loretoparisi
क्या आपने यूआरएल प्रकार जोड़ा है? यह मार्गदर्शिका में चरण 4 है: https://developers.google.com/+/mobile/ios/getting-started – Lefteris