react-native - NSMutableDictionary 无法转换为 ASAuthorizationAppleIDRequest
问题描述
我正在使用这个库在 React Native 中实现 Apple 登录: https ://github.com/invertase/react-native-apple-authentication 并且有一个用于 Apple 登录按钮的 onPress 事件的处理程序,如下所示:
import { appleAuth } from '@invertase/react-native-apple-authentication';
async function onAppleButtonPress() {
// performs login request
const appleAuthRequestResponse = await appleAuth.performRequest({
requestedOperation: appleAuth.Operation.LOGIN,
requestedScopes: [appleAuth.Scope.EMAIL, appleAuth.Scope.FULL_NAME],
});
// get current authentication state for user
// /!\ This method must be tested on a real device. On the iOS simulator it always throws an error.
const credentialState = await appleAuth.getCredentialStateForUser(appleAuthRequestResponse.user);
// use credentialState response to ensure the user is authenticated
if (credentialState === appleAuth.State.AUTHORIZED) {
// user is authenticated
}
}
但是,当我像这样将其转换为 clojurescript 时:
(reg-fx
:apple-signin-fx
(fn [navigation]
(go (let [appleAuthRequestResponse
(<p! (.performRequest appleAuth
(clj->js
{:requestedOperation (.. appleAuth -Operation -LOGIN)
:requestedScopes [(.. appleAuth -Scope -Email)
(.. appleAuth -Scope -FULL_NAME)]})))]))))
我收到以下错误:
JSON value '{
nonceEnabled = 1;
requestedOperation = 1;
requestedScopes = (
"<null>",
1
);
}' of type NSMutableDictionary cannot be converted to ASAuthorizationAppleIDRequest *
+[RCTConvert(ASAuthorizationAppleIDRequest) ASAuthorizationAppleIDRequest:]
RCTConvert+ASAuthorizationAppleIDRequest.m:85
__41-[RCTModuleMethod processMethodSignature]_block_invoke_16
-[RCTModuleMethod invokeWithBridge:module:arguments:]
facebook::react::invokeInner(RCTBridge*, RCTModuleData*, unsigned int, folly::dynamic const&)
facebook::react::RCTNativeModule::invoke(unsigned int, folly::dynamic&&, int)::$_0::operator()() const
invocation function for block in facebook::react::RCTNativeModule::invoke(unsigned int, folly::dynamic&&, int)
_dispatch_call_block_and_release
_dispatch_client_callout
_dispatch_main_queue_callback_4CF
__CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__
__CFRunLoopRun
CFRunLoopRunSpecific
GSEventRunModal
-[UIApplication _run]
UIApplicationMain
main
start
如何解决这个问题?
解决方案
推荐阅读
- c# - 我应该如何在 .NETStandard 1.3 中添加 System.Data.Table 引用?
- html - 背景图像显示图像的特定部分
- .net - .NET - 确保跨线程事件处理在处理表单后不会引发异常
- python-3.x - 如何更新,然后用 Python 和 DBUtils PersistentDB 选择更新的数据?
- angular - 传单 divIcon 未以角度显示在地图上
- json - 无法从 DynamoDB 数据库中为 Alexa 技能正确检索读取的 JSON 数据
- php - php中注册页面的数据库中的值未更新
- php - Codeigniter 复杂的 MySQL 查询
- python - 给定一个列表,如果存在,则从列表中删除索引 0,4,5
- opencv - Nim 无法打开“opencv/highgui”