在 iPhone 中实现 Google+ 时出错

Posted

技术标签:

【中文标题】在 iPhone 中实现 Google+ 时出错【英文标题】:Getting error to implement Google+ in iPhone 【发布时间】:2012-12-28 06:20:36 【问题描述】:

我正在使用 Google+ for ios 教程在 Objective-C iPhone 中实现 Google+,但是当我点击 Google+ 的登录按钮时出现此错误

2013-01-14 14:28:46.168 googleplus_tutorials[2468:11303] GTMMethodCheckMethodChecker: Class WebMIMETypeRegistry does not conform to @protocol(NSObject), so won't be checked
2013-01-14 14:28:46.176 googleplus_tutorials[2468:11303] GTMMethodCheckMethodChecker: Class UIKeyboardCandidateUtilities does not conform to @protocol(NSObject), so won't be checked
2013-01-14 14:28:55.544 googleplus_tutorials[2468:11303] *** Assertion failure in -[GPPSignInButton createGPPSignIn], /Volumes/BuildData/pulse-data/agents/wpyk8.hot/recipes/211255319/base/googlemac/Shared/GooglePlus/Dev/GooglePlusPlatform/GPPSignInButton.m:155
2013-01-14 14:28:55.545 googleplus_tutorials[2468:11303] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'You must specify a client ID for GPPSignInButton.'
*** First throw call stack:
(0x141e012 0x1243e7e 0x141de78 0xcd9f35 0x448c4 0x44688 0x1257705 0x18e920 0x18e8b8 0x24f671 0x24fbcf 0x24ed38 0x1be33f 0x1be552 0x19c3aa 0x18dcf8 0x2301df9 0x2301ad0 0x1393bf5 0x1393962 0x13c4bb6 0x13c3f44 0x13c3e1b 0x23007e3 0x2300668 0x18b65c 0x2e22 0x2d55)
libc++abi.dylib: terminate called throwing an exception

使用此链接,我正在我的 iphone 中实现 google+ https://developers.google.com/+/mobile/ios/getting-started 这是我的代码

- (void)viewDidLoad

    [super viewDidLoad];
  static NSString * const kClientId = @"711430132123.apps.googleusercontent.com";
   GPPShare *share = [[GPPShare alloc] initWithClientID:kClientId];
  signInButton = [[GPPSignInButton alloc]init];
   signInButton.delegate = self;
   signInButton.clientID = kClientId;
signInButton.scope = [NSArray arrayWithObjects:@"https://www.googleapis.com/auth/plus.moments.write",@"https://www.googleapis.com/auth/plus.me",nil];

    AppDelegate *appDelegate = (AppDelegate *)
    [[UIApplication sharedApplication] delegate];

    appDelegate.signInButton = signInButton;
    // Do any additional setup after loading the view, typically from a nib.

- (BOOL)application: (UIApplication *)application
            openURL: (NSURL *)url
  sourceApplication: (NSString *)sourceApplication
         annotation: (id)annotation 
    // Handle Google+ sign-in button URL.
    if ([signInButton handleURL:url
               sourceApplication:sourceApplication
                      annotation:annotation]) 
        return YES;
    
    return NO;

请告诉我为什么会出现此错误。

【问题讨论】:

自您发布此问题以来,iOS SDK 的新版本现已推出(2013 年 2 月 26 日)。你试过最新版本吗? 【参考方案1】:

你试过google+的universalLib(libGooglePlusUniversal.a)吗?跟踪您的崩溃后,我认为您尚未在目标中添加库。可能会对您有所帮助。

【讨论】:

以上是关于在 iPhone 中实现 Google+ 时出错的主要内容,如果未能解决你的问题,请参考以下文章

如何在 iPhone 和 Android 的 Titanium 中实现 Google Analytic?

是否可以在 Google App Engine 应用程序中实现 iPhone 推送通知?

测试 Google 应用内结算时出现“从服务器 RPC S-7 AEC-0 检索信息时出错”

如何使用 XMPP 框架在 iphone 中实现实时聊天? [关闭]

尝试在 android 中实现 SQlcipher 时出错

为 Android 开发实现 GoogleApiClient Builder 时出错