Google Plus登录集成错误iOS

嗨,我想在我的iOS应用程序上集成谷歌+登录。 我按照此链接的说明进行操作。

这些示例工作正常,但当我尝试在我的应用程序上实现时,它就是这样

errorTerminating app due to uncaught exception 'NSInvalidArgumentException', reason: '+[NSBundle gpp_registerFonts]: unrecognized selector sent to class 0x16af620'

我添加了以下框架Image Any help

代码:在我的视图的viewdidload中

 GPPSignIn *signIn = [GPPSignIn sharedInstance]; signIn.shouldFetchGooglePlusUser = YES; signIn.shouldFetchGoogleUserEmail = YES; // Uncomment to get the user's email // You previously set kClientId in the "Initialize the Google+ client" step signIn.clientID = kClientId; signIn.scopes = [NSArray arrayWithObjects: kGTLAuthScopePlusLogin, // defined in GTLPlusConstants.h nil]; // Optional: declare signIn.actions, see "app activities" signIn.delegate = self; 

之后我添加了这个function

 - (BOOL)application: (UIApplication *)application openURL: (NSURL *)url sourceApplication: (NSString *)sourceApplication annotation: (id)annotation { return [GPPURLHandler handleURL:url sourceApplication:sourceApplication annotation:annotation]; } - (void)finishedWithAuth: (GTMOAuth2Authentication *)auth error: (NSError *) error { NSLog(@"Received error %@ and auth object %@",error, auth); } 

我在类GPPSignInButton的视图中添加了一个按钮。

嗨问题是-ObjC。 虽然我之前添加了-ObjC,但我知道为什么它不起作用但是当我删除并再次添加它开始工作。 也许我先复制粘贴它,以便有任何空间或东西。

在app委托中你需要设置客户端ID,一旦你设置了这个你不需要在ViewController中再次设置它

你是否添加了GooglePlus.bundle如果没有添加它添加到你的项目

 - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { [GPPSignIn sharedInstance].clientID = kGoogleplusClientID; [GPPDeepLink setDelegate:self]; ...... } - (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation { return [GPPURLHandler handleURL:url sourceApplication:sourceApplication annotation:annotation]; } 

你的myView中的下一个你可以做这样的事情

  //in .h file @class GPPSignInButton; @interface ViewController : UIViewController @property (retain, nonatomic) IBOutlet GPPSignInButton *signInButton; //sign in button ..... //in .m file - (void)viewDidLoad { [GPPSignInButton class]; //for sign in button u need to put a view and set its calss name as `GPPSignInButton` and connect to IBOutlet of ur signInButton [GPPSignIn sharedInstance].shouldFetchGoogleUserEmail = YES; [GPPSignIn sharedInstance].shouldFetchGooglePlusUser = YES; GPPSignIn *signIn = [GPPSignIn sharedInstance]; signIn.delegate = self; ........ //if u are settings are all correct u will logged in successfully } 

我认为您正在使用带有IBOutlet连接的自定义按钮。 删除Storyboard中的sockets连接,然后重试。 它会工作。