0
が動作していない:Firebaseクラウドメッセージング(FCM)は、私がfirebaseウェブサイトのドキュメントのガイドに従い、以下のすべてのものをやった
1.はAppDelegate.swiftでコードを実装しました。
2.ポッドファイルにポッドを追加してインストールしました。
CertifictesでAPNの認証キーを作成し3.、私developer.appleアカウントで識別子& プロファイルをし、FCMの設定でそれを貼り付けます。
4.有効プロジェクトの機能でプッシュ通知(2つがチェックされています)。
5.作成した証明書の種類:生産
のためのアップルのプッシュサービスは、私がfirebaseコンソールからの通知のカップルを送って、私のiPhone(IOS 10.3)でいずれも受けていませんでした。 どのようなヒントをチェックする?私は何を取りこぼしたか?
Podfile:
use_frameworks!
# Pods for App
pod 'Firebase/Core'
pod 'Firebase/Crash'
pod 'Firebase/Messaging'
AppDelegate.swift:
import UIKit
import Firebase
import UserNotifications
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
// Use Firebase library to configure APIs.
FirebaseApp.configure()
if #available(iOS 10.0, *) {
// For iOS 10 display notification (sent via APNS)
UNUserNotificationCenter.current().delegate = self
let authOptions: UNAuthorizationOptions = [.alert, .badge, .sound]
UNUserNotificationCenter.current().requestAuthorization(
options: authOptions,
completionHandler: {_, _ in })
} else {
let settings: UIUserNotificationSettings =
UIUserNotificationSettings(types: [.alert, .badge, .sound], categories: nil)
application.registerUserNotificationSettings(settings)
}
application.registerForRemoteNotifications()
return true
}
:
ただこれはfirebase、みんなから「公式」サンプル(D私はそう思う)であるthis one :)
であなたのAppDelegate.swiftを比較します、あなたはアドホックバージョンではなく、デバッグモードでアプリをテストすると仮定しているので、生産用ではありません。 –
実際に私は生産上の問題を発見しました。バックグラウンドモードのリモート通知を有効にする必要がありますか? – LamaTo
する必要はありません。バックグラウンドモードのリモート通知を有効にせずにプッシュ通知を受け取ります。バックグラウンドモードのリモート通知は、サイレント通知が必要な場合にのみ使用されます。 –