小编syu*_*maK的帖子

(React Native - Using AWS Amplify) - 不变违规:本机模块不能为空

问题说明:

我正在使用此AWS Amplify 文档在我的 React-Native 应用程序中实现推送通知,并且使用 iOS 部分进行测试失败并显示错误“不变违规:本机模块不能为空”,但是如果我测试(获取设备令牌并发送推送通知)它工作的 Android 部分。我在 iOS 上看到的错误截图如下所示:

在此处输入图片说明

到目前为止我尝试过的:

  1. 将 react-native 版本从 0.59.10 升级到 0.61.5
  2. 根据this github post,我还尝试安装以下内容:

    @react-native-community/push-notification-ios

    npm 安装 aws-amplify@unstable

这个模块 ( aws-amplify@unstable ) 引入了一个错误,说TypeError: undefined is not an object (evaluating '_core.Amplify.register')所以我决定摆脱它。

  1. 使用最新的“@aws-amplify/pushnotification”包:“^3.0.13”适用于Android,但在iOS中我又回到原来的错误:“不变违规:本机模块不能为空

目前我已经离开了我的 package.json 如下:

"dependencies": {
"@aws-amplify/pushnotification": "^1.1.4",
"@aws-amplify/analytics": "^1.3.3",
"@react-native-community/netinfo": "^5.7.0",
"@react-native-community/push-notification-ios": "^1.2.0",
"amazon-cognito-identity-js": "^4.2.1",
"aws-amplify": "^1.2.4",
"aws-amplify-react-native": "^4.2.0",
"axios": "^0.19.2",
"cache": "^2.3.1",
"react": "16.9.0",
"react-native": "^0.62.2"
} …
Run Code Online (Sandbox Code Playgroud)

react-native aws-pinpoint aws-amplify

8
推荐指数
1
解决办法
9674
查看次数

如何使用 AWS 推送通知服务修复未注册或过期的令牌错误

我正在尝试将 AWS 推送通知服务与 IOS 平台集成,但从控制台发送通知时出现未注册或过期令牌错误。

我已通过亚马逊 API 注册了设备,该设备显示活动状态。遵循创建 SSL 证书、设置 AWS SDK 的所有步骤,也尝试生成不同的生产证书和沙箱证书。

var pinpoint: AWSPinpoint?

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
        
        registerForPushNotifications()
        
        /** start code copy **/
        // Create AWSMobileClient to connect with AWS
        AWSMobileClient.sharedInstance().initialize { (userState, error) in
            if let error = error {
                print("Error initializing AWSMobileClient: \(error.localizedDescription)")
            } else if let userState = userState {
                print("AWSMobileClient initialized. Current UserState: \(userState.rawValue)")
            }
        }
        
        // Initialize Pinpoint
        let pinpointConfiguration = AWSPinpointConfiguration.defaultPinpointConfiguration(launchOptions: launchOptions)
        pinpoint = …
Run Code Online (Sandbox Code Playgroud)

push-notification amazon-web-services ios

5
推荐指数
0
解决办法
1503
查看次数

如何通过 POSTMAN 使用 AWS Translate“TranslateText”API

我正在使用 AWS Translate 构建 POC,要求之一是使用 REST API。

我构建了以下网址:

在此输入图像描述

但是当我使用 POSTMAN 点击 url 时,出现以下错误:

{
    "__type": "UnknownOperationException"
}
Run Code Online (Sandbox Code Playgroud)

postman amazon-translate

-1
推荐指数
1
解决办法
1723
查看次数