我的LoginButton工作正常,但我的LoginManager沒有工作。react-native FBSDK 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年至今,臉譜公司 *保留所有權利。 * *此源代碼根據源樹的根目錄中的 * LICENSE文件中的BSD樣式許可證進行許可。在同一目錄中的PATENTS文件中可以找到專利權的額外授權 *。 */
進口導入 「AppDelegate.h」
INT主(INT的argc,字符* argv的[]){ @autoreleasepool { 返回UIApplicationMain(的argc,argv的,零,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
人有一個想法陳健波青睞?
我堅持了同樣的問題。我唯一的「提示」是,它可能與SDK添加到XCode項目的方式有關。我期待着今天和明天,你身邊的進展如何? – IanBussieres
@IanBussieres嘿,我實際上通過刪除任何對以前使用的Facebook登錄包或文件的引用來解決這個問題。我之前從react-native-facebook-login使用FBLoginManager,並將其從xcode中移除,並且FBSDK LoginManager正常工作! – kyangy
您應該將其設置爲答案。我意識到我的同事已經安裝了完全相同的軟件包及其二進制文件。我刪除了所有內容,從頭開始安裝react-native-fbsdk並且它可以工作。我肯定會讚揚你的回答。 – IanBussieres