2016-05-22 8 views
0

は表示されません私はAppDelegateのdidFinishLaunchingWithOptions:PubNubのプッシュ通知

PNConfiguration *pnConfiguration = [PNConfiguration configurationWithPublishKey:publishKey 
                    subscribeKey:subscribeKey]; 
self.client = [PubNub clientWithConfiguration:pnConfiguration]; 

/* push notifications */ 
UIUserNotificationType types = UIUserNotificationTypeBadge | 
UIUserNotificationTypeSound | UIUserNotificationTypeAlert; 

UIUserNotificationSettings *mySettings = 
[UIUserNotificationSettings settingsForTypes:types categories:nil]; 

[[UIApplication sharedApplication] registerUserNotificationSettings:mySettings]; 
[[UIApplication sharedApplication] registerForRemoteNotifications]; 

としてだけでなく、これらの2つの方法で設定し、このコードを持っています私のアプリIDを入力し、PubNubコンソールに証明書をアップロードしましたhere

ここにプッシュ通知を送信するコードはありますか:

[self.client publish:nil toChannel:@"apns" mobilePushPayload: @{@"aps": @{@"alert":message}} 
withCompletion:^(PNPublishStatus *status) { 
    // Check whether request successfully completed or not. 
    // if (status.isError) // Handle modification error. 
    // Check 'category' property to find out possible issue because 
    // of which request did fail. Request can be resent using: [status retry]; 
}]; 

ただし、iOSシミュレータから公開するときに私のiPhoneに通知は表示されません。 これはなぜですか?

+0

[PubNubモバイルプッシュトラブルシューティングガイド](https://www.pubnub.com/knowledge-base/discussion/1127/how-can-i-troubleshoot-my-push-notification-issues)に従うことはできますか?それでも問題を特定できない場合は、貴重なデータポイントを提供しますか? –

+0

トラブルシューティングガイドは役に立ちましたか? –

+0

@CraigConoverまだそれを見ています。 Firebaseは、プッシュ通知機能を備えているように見えます。まだ何を手に入れるべきかわからない – Erik

答えて

0

プッシュ通知はシミュレータでは機能しません。実際のデバイスでテストする必要があります。

+0

実際のiPhone 5Sで通知を聞いていますが、シミュレータから送信しています。 – Erik