在IOS应用程序中登录Facebook的对象不能为零

我试图将Facebook兼容性整合到我的游戏中,以便能够在游戏结束时分享你的分数.

我已经按照Facebook的文档中列出的所有步骤进行了操作,但我似乎无法找到导致此错误的原因或设置为nil的对象.

当我按下从以下代码生成的登录按钮时:

FBSDKLoginButton *loginButton = [[FBSDKLoginButton alloc] init];
loginButton.center = self.view.center;
[self.view addSubview:loginButton];

我收到此错误:

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** setObjectForKey: object cannot be nil (key: client_id)'
*** First throw call stack:
(0x183fc659c 0x1946cc0e4 0x183eb11f8 0x1000b690c 0x1000b6d18 0x1000b6cc4 0x1000b5b8c 0x1000b2794 0x1887a9418 0x18879252c 0x1887a8db4 0x1887a8a40 0x1887a1f94 0x18877568c 0x188a1460c 0x188773bf4 0x183f7e9ec 0x183f7dc90 0x183f7bd40 0x183ea90a4 0x18d04b5a4 0x1887daaa4 0x1000a3f0c 0x194d3aa08)
libc++abi.dylib: terminating with uncaught exception of type NSException

谢谢!

编辑:

0   Eggs                                0x00000001000e1994 -[GameViewController viewDidLoad] + 920
1   UIKit                               0x0000000188775184 <redacted> + 692
2   UIKit                               0x0000000188774e94 <redacted> + 32
3   UIKit                               0x000000018877b55c <redacted> + 72
4   UIKit                               0x0000000188778cdc <redacted> + 260
5   UIKit                               0x00000001887e9d24 <redacted> + 56
6   UIKit                               0x00000001889fd890 <redacted> + 2804
7   UIKit                               0x00000001889ffe08 <redacted> + 1480
8   UIKit                               0x00000001889fe4a0 <redacted> + 184
9   FrontBoardServices                  0x000000018c23562c <redacted> + 28
10  CoreFoundation                      0x0000000183f7ea28 <redacted> + 20
11  CoreFoundation                      0x0000000183f7db30 <redacted> + 312
12  CoreFoundation                      0x0000000183f7c154 <redacted> + 1756
13  CoreFoundation                      0x0000000183ea90a4 CFRunLoopRunSpecific + 396
14  UIKit                               0x00000001887dfaac <redacted> + 552
15  UIKit                               0x00000001887daaa4 UIApplicationMain + 1488
16  Eggs                                0x00000001000e7efc main + 116
17  libdyld.dylib                       0x0000000194d3aa08 <redacted> + 4

最佳答案 我有同样的问题,但我通过检查info.plist来解决它.我建议仔细检查你的拼写.它需要是FacebookAppID,我把它作为FacebookID.当我修正错字时,它运行正常.但是,您可能会遇到不同的问题.

点赞