代码之家  ›  专栏  ›  技术社区  ›  Paul

InAppMessaging。AWSPinpointProvider-未能初始化AWSPinpoint“,[错误:找不到本机模块]

  •  0
  • Paul  · 技术社区  · 2 年前

    我最近更新了我的react原生应用程序,该应用程序使用@aws-amplify/pushnotification(已弃用)来使用@aws-camplify/rtn-push-notification。这涉及到以下迁移过程: https://docs.amplify.aws/lib/push-notifications/migrate-from-previous-version/q/platform/react-native/ .

    此更新之后,调用Analytics.updateEndpoint现在导致错误:

    InAppMessaging.AWSPinpointProvider - Failed to initialize AWSPinpoint', [Error: Native module not found]
    

    我真的不明白为什么InAppMessaging在错误中被引用,因为我还没有安装它,与推送通知无关。

    以下是尝试运行此请求的代码:

    import {Analytics} from 'aws-amplify';
    
    const handleToken = async () => {
      const { attributes: {sub} } = await Auth.currentUserInfo();
      const token = await AsyncStorage.getItem('pushNotificationToken');
    
      if (sub && token) {
        Analytics.updateEndpoint({
          address: token,
          optOut: "NONE",
          userId: sub,
          channelType: Platform.OS === 'ios' ? "APNS" : "GCM",
        }).then((response) => {
          console.log('created', response);
        }).catch((error) => {
          console.log('Error updating endpoint', error);
        });
      }
    }
    

    这是包含所有包和版本的package.json:

    {
      "name": "App",
      "version": "0.0.1",
      "private": true,
      "scripts": {
        "android": "react-native run-android",
        "ios": "react-native run-ios",
        "lint": "eslint .",
        "start": "react-native start",
        "test": "jest"
      },
      "dependencies": {
        "@aws-amplify/rtn-push-notification": "^1.1.2",
        "@react-native-async-storage/async-storage": "1.17.11",
        "@react-native-community/masked-view": "^0.1.11",
        "@react-native-community/netinfo": "^9.4.1",
        "@react-navigation/bottom-tabs": "^6.5.7",
        "@react-navigation/native": "^6.1.6",
        "@react-navigation/native-stack": "^6.9.12",
        "amazon-cognito-identity-js": "^6.3.1",
        "aws-amplify": "^5.3.5",
        "nativewind": "^2.0.11",
        "package": "^1.0.1",
        "postcss": "8.4.23",
        "react": "^18.2.0",
        "react-native": "^0.71.12",
        "react-native-circular-progress": "^1.3.9",
        "react-native-gesture-handler": "^2.12.0",
        "react-native-gradle-plugin": "^0.71.19",
        "react-native-linear-gradient": "^2.8.0",
        "react-native-reanimated": "3.3.0",
        "react-native-safe-area-context": "^4.7.1",
        "react-native-safe-area-view": "^1.1.1",
        "react-native-screens": "^3.23.0",
        "react-native-snap-carousel-v4": "^1.0.1",
        "react-native-splash-screen": "^3.3.0",
        "react-native-svg": "^13.10.0",
        "react-native-vector-icons": "^10.0.0",
        "tailwindcss": "3.3.2"
      },
      "devDependencies": {
        "@babel/core": "^7.20.0",
        "@babel/preset-env": "^7.20.0",
        "@babel/runtime": "^7.20.0",
        "@react-native/eslint-config": "^0.72.2",
        "@react-native/metro-config": "^0.72.5",
        "@tsconfig/react-native": "^3.0.0",
        "@types/react": "^18.0.24",
        "@types/react-test-renderer": "^18.0.0",
        "babel-jest": "^29.2.1",
        "eslint": "^8.19.0",
        "jest": "^29.2.1",
        "metro-react-native-babel-preset": "0.76.7",
        "prettier": "^2.4.1",
        "react-native-flipper": "^0.207.0",
        "react-test-renderer": "18.2.0",
        "typescript": "^5.1.6"
      },
      "engines": {
        "node": ">=16"
      }
    }
    
    0 回复  |  直到 2 年前