DidgisterforrmotenotificationswithDevicetoken не называется Swift 5, Xcode 10.2IOS

Программируем под IOS
Ответить
Anonymous
 DidgisterforrmotenotificationswithDevicetoken не называется Swift 5, Xcode 10.2

Сообщение Anonymous »

Код: Выделить всё

didRegisterForRemoteNotificationsWithDeviceToken
and didFailToRegisterForRemoteNotificationsWithError is not getting called on real device.

This what i have tried so far:

In didFinishLaunchingWithOptions

FirebaseApp.configure()

if #available(iOS 10.0, *) {
let center = UNUserNotificationCenter.current()
center.delegate = self
center.requestAuthorization(options: [.badge, .alert, .sound]) {
(granted, error) in
if granted {
DispatchQueue.main.async {
application.registerForRemoteNotifications()
//UIApplication.shared.registerForRemoteNotifications()
}
} else {
//print("APNS Registration failed")
//print("Error: \(String(describing: error?.localizedDescription))")
}
}
} else {
let type: UIUserNotificationType = [UIUserNotificationType.badge, UIUserNotificationType.alert, UIUserNotificationType.sound]
let setting = UIUserNotificationSettings(types: type, categories: nil)
application.registerUserNotificationSettings(setting)
application.registerForRemoteNotifications()
//UIApplication.shared.registerForRemoteNotifications()
}
< /code>

Затем метод регистра и сбоя: < /p>

private func application(application: UIApplication,
didRegisterForRemoteNotificationsWithDeviceToken deviceToken: NSData) {
Messaging.messaging().apnsToken = deviceToken as Data
print("Registered Notification")
}

func application(_ application: UIApplication, didFailToRegisterForRemoteNotificationsWithError error: Error) {

print(error.localizedDescription)
print("Not registered notification")
}
< /code>

Примечание. Ошибка. (Что означает, что код в порядке) < /li>
[*] Я дважды проверил сертификаты и восстановил файл подводного обеспечения после включения уведомлений Push в
. Переустановка приложений много раз не работает.
FirebaseAppDelegateProxyenabled установлен в NO в PLIST по -прежнему не повезло.>

Подробнее здесь: https://stackoverflow.com/questions/558 ... ed-swift-5
Ответить

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

Вернуться в «IOS»