我的LoginButton工作,但我的LoginManager没有 .
handleLogin = () => {
LoginManager.logInWithReadPermissions(['public_profile']).then(
function(result) {
if (result.isCancelled) {
alert('Login cancelled');
} else {
alert('Login success with permissions: '
+ result.grantedPermissions.toString());
}
},
function(error) {
alert('Login fail with error: ' + error);
}
)
}
当调用handleLogin()时,它会指示我显示这个的xcode .
/ ** *版权所有(c)2015-present,Facebook,Inc . 保留所有权利 . * 此源代码根据此源树根目录中 LICENSE文件中的BSD样式许可证进行许可 . 可以在同一目录中的PATENTS文件中找到额外的专利权授予 . * / import import“AppDelegate.h”int main(int argc,char * argv []){@ autoreleasepool {return UIApplicationMain(argc,argv,nil,NSStringFromClass([AppDelegate> class])); }}
在我的xcode控制台中,错误显示了这一点,
2016-07-14 17:04:36.591 asklegit[2749:839107] *** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArrayI objectAtIndex:]: index 4 beyond bounds [0 .. 3]' *** First throw call stack: ( 0 CoreFoundation 0x0000000110e5cd85 __exceptionPreprocess + 165 1 libobjc.A.dylib 0x000000010fd1bdeb objc_exception_throw + 48 2 CoreFoundation 0x0000000110d45934 -[__NSArrayI objectAtIndex:] + 164 3 asklegit 0x000000010f344640 -[RCTBatchedBridge _handleRequestNumber:moduleID:methodID:params:] + 368 4 asklegit 0x000000010f343600 __33-[RCTBatchedBridge handleBuffer:]_block_invoke.460 + 1424 5 libdispatch.dylib 0x0000000114637d9d _dispatch_call_block_and_release + 12 6 libdispatch.dylib 0x00000001146583eb _dispatch_client_callout + 8 7 libdispatch.dylib 0x00000001146401ef _dispatch_main_queue_callback_4CF + 1738 8 CoreFoundation 0x0000000110db60f9 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9 9 CoreFoundation 0x0000000110d77b99 __CFRunLoopRun + 2073 10 CoreFoundation 0x0000000110d770f8 CFRunLoopRunSpecific + 488 11 GraphicsServices 0x0000000115d0ead2 GSEventRunModal + 161 12 UIKit 0x0000000112fb8f09 UIApplicationMain + 171 13 asklegit 0x000000010f2c7cff main + 111 14 libdyld.dylib 0x000000011468c92d start + 1 15 ??? 0x0000000000000001 0x0 + 1 ) libc++abi.dylib: terminating with uncaught exception of type NSException
任何人都有一个想法?
2 回答
通过删除对以前使用的facebook登录包或文件的任何引用来解决此问题 . 我以前在react-native-facebook-login中使用了FBLoginManager,我从xcode中移除了它,FBSDK LoginManager正常工作!
如果有人在_734769中遇到此问题,请在应用程序中使用通用Deeplink时小心 . 我在应用程序中使用它们,并在我的应用程序中使用了
AppDelegate.m
.现在,由于深层链接代码即将在Facebook链接之前发布,因此它会接收您的网址并且承诺永远不会得到解决 . 因此,将链接代码移动到最后 . 所以你的整个代码看起来像:
希望能帮助到你 :)