Iphone 公共图书馆+;React native-iOS real设备上无横幅通知

Iphone 公共图书馆+;React native-iOS real设备上无横幅通知,iphone,react-native,push-notification,pubnub,react-native-ios,Iphone,React Native,Push Notification,Pubnub,React Native Ios,我已经将Pubnub Javascript sdk-v4与我的react本机项目集成。 并已用于响应本机推送通知。在两个模拟器(android和iOS)中,当应用程序在后台运行时(即使应用程序已关闭),也会显示通知横幅。但是,在实际设备上测试时,不会显示通知横幅。通知仅显示在通知栏中(从屏幕顶部滚动时)。有什么建议吗 代码段如下所示 . . var PushNotification = require('react-native-push-notification'); var serviceC

我已经将Pubnub Javascript sdk-v4与我的react本机项目集成。 并已用于响应本机推送通知。在两个模拟器(android和iOS)中,当应用程序在后台运行时(即使应用程序已关闭),也会显示通知横幅。但是,在实际设备上测试时,不会显示通知横幅。通知仅显示在通知栏中(从屏幕顶部滚动时)。有什么建议吗

代码段如下所示

.
.
var PushNotification = require('react-native-push-notification');
var serviceCall = require('../../actions/serviceCall');
import PushController from '../../actions/pushController'
var PubNub = require('pubnub');
.
.

class SearchBar extends Component {
    constructor(props) {
        super(props);
        this.state = {
            ...
            ...

        };
        this.constructor.childContextTypes = {
            theme: React.PropTypes.object,
        }

    }
componentDidMount(){

    var pubnub = new PubNub({
        publishKey : 'pub-c-xxxxxx', 

        subscribeKey : 'sub-c-xxxxxx'


      })
      var notifyListener ={
        message: function(message) {

            console.warn(JSON.stringify(message));
            PushNotification.localNotification({

                message: message.message.text, // (required)

            });

        }
      }
    pubnub.addListener(notifyListener);

    pubnub.subscribe({
        channels: ['Channel-xxxxxxx']
        });
    }

return (
            <Container>
                    <View theme={theme}>
                    <PushController/>
                    .
                    .
                    .
                    </View>
            </Container>
        )
}
。
.
var PushNotification=require('react-native-push-notification');
var serviceCall=require('../../actions/serviceCall');
从“../../actions/PushController”导入PushController
var PubNub=require('PubNub');
.
.
类搜索栏扩展组件{
建造师(道具){
超级(道具);
此.state={
...
...
};
this.constructor.childContextTypes={
主题:React.PropTypes.object,
}
}
componentDidMount(){
var pubnub=新的pubnub({
publishKey:'pub-c-xxxxxx',
订阅键:“sub-c-xxxxxx”
})
var notifyListener={
消息:函数(消息){
console.warn(JSON.stringify(message));
PushNotification.localNotification({
消息:message.message.text,//(必需)
});
}
}
addListener(notifyListener);
订阅({
频道:['Channel-xxxxxxx']
});
}
返回(
.
.
.
)
}

我不得不改变集成方法,这个链接成功了


链接:

你能用同一文件中的完整代码更新你的代码吗?@CraigConover,很高兴收到你的来信。我更新了代码段。我无法将所有代码文件放在这里。这是代码文件的流程,这是导航的第一页。(用户登录后的主页)。嗨@CraigConover,有更新吗?我们需要更多详细信息。您能否将完整的压缩项目连同复制步骤和数据提交给support@pubnub.com? 问题解决后,我们可以将答案发布回这里。这是我如何将通知方法与Pubnub集成的问题。然后我尝试了这个()并且成功了。谢谢@CraigConover的帮助。你能上传更新的工作代码吗?我遇到了同样的问题,文档有点混乱