iOSアプリにFireBaseのCloud Messagingを使ってPush通知を実装しようとしています。
Firebaseのチュートリアルどおりに実装をしているのですが、うまくいきません。
アプリや証明書のエラーも出ておらず手がかりがない状態です。
以下AppDelegate.swiftへの記述を記載します。
import Firebase import UserNotifications @UIApplicationMain class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterDelegate { var window: UIWindow? private let userDefaults = UserDefaults.standard func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { // Override point for customization after application launch. FirebaseApp.configure() application.registerForRemoteNotifications() requestNotificationAuthorization(application: application) return true } func requestNotificationAuthorization(application: UIApplication) { if #available(iOS 10.0, *) { 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) } } --以下省略-- }
思い当たる解決方法や、参照すべきWebページなどありましたらご教示いただけるとありがたいです。
よろしくお願いいたします。
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2017/09/24 02:57
2017/09/24 03:33