相关疑难解决方法(0)

必须仅从主线程调用UIApplication.registerForRemoteNotifications()

Xcode 9(iOS 11)在注册Push(远程)通知时向我显示错误/警告.

这是错误消息

在此输入图像描述

这是代码,我尝试过:

let center  = UNUserNotificationCenter.current()
center.delegate = self
center.requestAuthorization(options: [.sound, .alert, .badge]) { (granted, error) in
        if error == nil{
              UIApplication.shared.registerForRemoteNotifications()
        }
 }
Run Code Online (Sandbox Code Playgroud)

错误/警告线:

UIApplication.shared.registerForRemoteNotifications()

怎么解决这个?

push-notification ios swift unusernotificationcenter swift4

71
推荐指数
5
解决办法
3万
查看次数

升级Firebase破坏了我的iOS项目

我希望我从来没有更新我的pod,整个项目都充满了错误,下面的照片中有一个特定的错误,我无法修复它,我已经准备好将我的应用程序提交到App Store了,现在它似乎全部毁了.最重要的是,它让我删除了一堆选项.

错误信息

 func uploadData(user: User) {
    let changeRequest = user.createProfileChangeRequest()
    changeRequest.displayName = self.nameUser.text!
    changeRequest.commitChanges(completion: nil)

    let imageRef = self.userStorage.child("\(user.uid).jpg")

    let data = UIImageJPEGRepresentation(self.imageView.image!, 0.5)

    let uploadTask = imageRef.put(data!, metadata: nil, completion: { (metadata, err) in
        if err != nil {
            print(err!.localizedDescription)
        }

        imageRef.downloadURL(completion: { (url, er) in
            if er != nil {
                print(er!.localizedDescription)
            }


            if let url = url {



                let userInfo: [String : Any] =  ["age" : self.ageUser.text!,
                                                 "location" : self.location.text!,
                                                 "name" : self.nameUser.text!,
                                                 "image" : url.absoluteString,
                                                 "bio" : …
Run Code Online (Sandbox Code Playgroud)

xcode ios cocoapods firebase swift

7
推荐指数
1
解决办法
1425
查看次数