Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/swift/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 应用程序代理swizzling已禁用远程通知_Ios_Swift_Firebase - Fatal编程技术网

Ios 应用程序代理swizzling已禁用远程通知

Ios 应用程序代理swizzling已禁用远程通知,ios,swift,firebase,Ios,Swift,Firebase,我想与Firebase进行电话验证,但我无法发送通知。我正在共享AppDelegatecode。我不知道我该怎么做?我执行了证书插入FirebaseAppDelegateProxyEnabled是值no class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterDelegate, MessagingDelegate { func applicationReceivedRemoteMessage(

我想与Firebase进行电话验证,但我无法发送通知。我正在共享
AppDelegate
code。我不知道我该怎么做?我执行了证书插入
FirebaseAppDelegateProxyEnabled
是值
no

class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterDelegate, MessagingDelegate {

func applicationReceivedRemoteMessage(_ remoteMessage: MessagingRemoteMessage) {
  print(remoteMessage.appData)
}

func registerForPushNotifications() {
  UNUserNotificationCenter.current()
    .requestAuthorization(options: [.alert, .sound, .badge]) { granted, error in
      print("Permission granted: \(granted)") // 3
    }
  }

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
  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 })

    // For iOS 10 data message (sent via FCM
    Messaging.messaging().delegate = self
  } else {
    let settings: UIUserNotificationSettings = UIUserNotificationSettings(types: [.alert, .badge, .sound], categories: nil)
    application.registerUserNotificationSettings(settings)
  }

  application.registerForRemoteNotifications()
  FirebaseApp.configure()      
}
代码发送功能

func sendCode(_ sender: Any) {
  let alert = UIAlertController(title: "Phone number", message: "Is this your phone number? \n \(emailField.text!)", preferredStyle: .alert)
  let action = UIAlertAction(title: "Yes", style: .default) { (UIAlertAction) in
    PhoneAuthProvider.provider().verifyPhoneNumber(self.emailField.text!, uiDelegate: nil) { (verificationID, error) in
      if error != nil {
        print("eror: \(String(describing: error?.localizedDescription))")
      } else {
        let defaults = UserDefaults.standard
        defaults.set(verificationID, forKey: "authVID")
      }
    }
  }

  let cancel = UIAlertAction(title: "No", style: .cancel, handler: nil)
  alert.addAction(action)
  alert.addAction(cancel)
  self.present(alert, animated: true, completion: nil)
}

您对推送通知证书做了什么?是的,我无缝地添加了它。当我使用Firebase发送通知时,它会起作用。好的,您发送的负载是什么?我将其添加到主题中。您是否使用云功能发送通知?您对推送通知证书做了什么?是的,我无缝添加了它。当我使用Firebase发送通知时,它会起作用。好的,您发送的负载是什么?我已将其添加到主题中。您是否使用云功能发送通知?