Локальное уведомление не работает при отправке приложения в магазин приложений

У меня проблема, когда локальное уведомление не работает, когда я отправляю обновление для своего приложения. Я протестировал свое устройство, и оно работало, но когда я загружаю приложение из AppStore, уведомление вообще не работает, вот код AppDelgate:

    class AppDelegate: UIResponder, UIApplicationDelegate,UNUserNotificationCenterDelegate

 @available(iOS 10.0, *)
    func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping () -> Void) {

    }
    @available(iOS 10.0, *)
    func userNotificationCenter(_ center: UNUserNotificationCenter, willPresent notification: UNNotification, withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void) {
        completionHandler([.alert,.sound])
    }

и я реализовал этот код для отправки уведомления, когда таймер сработал в день выпуска

  import UserNotifications
     let center = UNUserNotificationCenter.current()
      let options : UNAuthorizationOptions = [.alert, .sound, .badge]

            center.requestAuthorization(options: options) { (granted, error) in
                if !granted {
                    print("Somthing went wrong")

                }
            }

            center.getNotificationSettings { (settings) in
                if settings.authorizationStatus != .authorized {
                    print("Notification not allowd")
                }
            }

    here is in different function that calculate the time and send notification, I have not put the code for timer to make it more visual for others 


     let content = UNMutableNotificationContent()
                content.title = NSLocalizedString("NOTIFICATION_TITLE", comment: "Game Released")
                content.body = "\(self.currentGame.gameName) Released ✌????"
                content.sound = UNNotificationSound.default()

                let date = dateFormatter.date(from: currentGame.gameDate)
                let triggerDate = Calendar.current.dateComponents([.year,.month,.day,.hour,.minute,.second], from: date!)
                let trigger = UNCalendarNotificationTrigger(dateMatching: triggerDate, repeats: false)
                let indetifier = "UYLLocalNotification"
                let request = UNNotificationRequest(identifier: indetifier, content: content, trigger: trigger)
                center.add(request, withCompletionHandler: { (error) in
                    if error != nil{
                        print("Something went wrong here ")

                    }
                })


            }
            else {
                gamesCountdownLabel.text! = countdownText
            }

Я надеюсь, что кто-то может мне помочь. Я пробовал все решения, но все еще не работал для пользователей, кроме моего устройства разработки.


person Yousef Abu Sallamah    schedule 08.02.2017    source источник
comment
Пожалуйста, сообщите нам, что именно происходит, когда устройство вообще не работает, и на какой версии iOS работают рабочие и нерабочие устройства.   -  person shallowThought    schedule 08.02.2017
comment
@shallowThought вообще не работает, все версии включают iOS 10   -  person Yousef Abu Sallamah    schedule 09.02.2017
comment
кто может помочь пожалуйста с этим вопросом   -  person Yousef Abu Sallamah    schedule 26.02.2017


Ответы (1)


Проблема с делегатом уведомления и проверка времени и даты уведомления

person Yousef Abu Sallamah    schedule 03.03.2017