如何在cordova iOS应用程序中实现推送通知

时间:2022-09-02 11:07:17

I have followed the below steps

我按照以下步骤操作

My cordova app version is 3.9.2

我的cordova app版本是3.9.2

As per this tutorial https://www.raywenderlich.com/32960/apple-push-notification-services-in-ios-6-tutorial-part-1

根据本教程https://www.raywenderlich.com/32960/apple-push-notification-services-in-ios-6-tutorial-part-1

I have generated provisionals, certificates and pem file. After that started on installation of push notification plugin

我已经生成了临时文件,证书和pem文件。之后开始安装推送通知插件

  1. Installing Push notification plugin

    安装推送通知插件

    cordova plugin add phonegap-plugin-push --variable SENDER_ID="JYOSHNASENDER"
    

While installing a plugin, shows a warning message.

安装插件时,会显示警告消息。

Plugin doesn't support this project's cordova-ios version. cordova-ios: 3.9.2, failed version requirement: >=4.0.0 Skipping 'phonegap-plugin-push' for ios

So, As per this message i have upgraded my platform through this command

因此,根据此消息,我已通过此命令升级了我的平台

cordova platform update ios@ 4.0.1

After this, When i'm trying to build the app on device am getting error in MainViewController.h file

在此之后,当我尝试在设备上构建应用程序时,我在MainViewController.h文件中出现错误

No visible @interface for 'CDVViewController' declares the selector 'webviewdidiFinishLoad:'

Note: Shall i need to add didReceiveRemoteNotification method for cordova ios project.

注意:我需要为cordova ios项目添加didReceiveRemoteNotification方法。

Please let me know how to resolve the issue.

请让我知道如何解决这个问题。

1 个解决方案

#1


6  

There is a known cordova-ios issue where the cordova platform update command does not work correctly under the covers and then when you build the updated project you will get the No visible @interface for 'CDVViewController' declares the selector 'webviewdidiFinishLoad:' error (see here for details: https://issues.apache.org/jira/browse/CB-9254). The workaround is to remove the ios platform, then add it back, rather than updating it in place. So:

有一个已知的cordova-ios问题,其中cordova平台更新命令无法正常工作,然后当您构建更新的项目时,您将获得'CDVViewController'的No visible @interface声明选择器'webviewdidiFinishLoad:'错误(有关详细信息,请参阅此处:https://issues.apache.org/jira/browse/CB-9254)。解决方法是删除ios平台,然后将其添加回来,而不是将其更新到位。所以:

cordova platform rm ios
cordova platform add ios@4.0.1

and then add the plugin:

然后添加插件:

cordova plugin add phonegap-plugin-push --variable SENDER_ID="JYOSHNASENDER"

#1


6  

There is a known cordova-ios issue where the cordova platform update command does not work correctly under the covers and then when you build the updated project you will get the No visible @interface for 'CDVViewController' declares the selector 'webviewdidiFinishLoad:' error (see here for details: https://issues.apache.org/jira/browse/CB-9254). The workaround is to remove the ios platform, then add it back, rather than updating it in place. So:

有一个已知的cordova-ios问题,其中cordova平台更新命令无法正常工作,然后当您构建更新的项目时,您将获得'CDVViewController'的No visible @interface声明选择器'webviewdidiFinishLoad:'错误(有关详细信息,请参阅此处:https://issues.apache.org/jira/browse/CB-9254)。解决方法是删除ios平台,然后将其添加回来,而不是将其更新到位。所以:

cordova platform rm ios
cordova platform add ios@4.0.1

and then add the plugin:

然后添加插件:

cordova plugin add phonegap-plugin-push --variable SENDER_ID="JYOSHNASENDER"