Present State of affairs?:
Th registered consumer of the e-book app will get the notifications equivalent to ‘books out there for obtain’, q&A portal solutions, reside streaming hyperlink.

What’s the objective?:
To get the notifications for visitor the place it will possibly present the out there books for obtain, and different notification that comes for registered consumer.

What’s the situation/errors?:
When consumer clicks on the notification button , nothing comes on the display. The whole lot clean and no notification is proven. It present the beneath error::
enter image description here

What i attempted?:
Once we name API, the token is generated from the backend. This token is then used to get the entry. At present the token is just not generated and the log exhibits unauthorised. I attempted to repeat the API technique to the home-screen that’s used from ‘signUpVC'(enroll view controller).

Code: for SignUp

import UIKit
import PKHUD
import SDWebImage

class SignupVC: ThemeController {

    // MARK: - Shops
    
    @IBOutlet weak var imgProfile: TappableImageView!
    
    
    @IBOutlet weak var passwordView: UIStackView!
    @IBOutlet weak var lblRegister: UILabel!
    
    
    var isFromUpdateProfile = Bool()
    
    
    // -----------------------------------------------------------------------------------------------
    
    // MARK: - Class Properties
    
    @IBOutlet weak var txtFirstName: UITextField!
    @IBOutlet weak var txtLastName: UITextField!
    @IBOutlet weak var txtEmail: UITextField!
    @IBOutlet weak var txtCity: UITextField!
    @IBOutlet weak var txtPassword: UITextField!
    
    // -----------------------------------------------------------------------------------------------
    
    // MARK: - Reminiscence Administration Capabilities
    
    override func didReceiveMemoryWarning() {
        tremendous.didReceiveMemoryWarning()
        // Get rid of any sources that may be recreated.
    }
    
    deinit {
        
    }
    
    // -----------------------------------------------------------------------------------------------
    
    // MARK: - Class Capabilities
    
    non-public func errorsInTextFields() -> String? {
        self.view.endEditing(true)
        
        guard !txtFirstName.isEmpty else { return UserMessages.kBlankFirstName }
        guard txtFirstName.hasValid(.alphabetWithSpace) else { return UserMessages.kValidFirstName }
        
        guard !txtLastName.isEmpty else { return UserMessages.kBlankLastName }
        guard txtLastName.hasValid(.alphabetWithSpace) else { return UserMessages.kValidLastName }
        
        guard !txtEmail.isEmpty else { return UserMessages.kBlankEmail }
        guard txtEmail.hasValid(.e-mail) else { return UserMessages.kValidEmail }
        
        guard !txtCity.isEmpty else { return UserMessages.kBlankCity }
        guard txtCity.hasValid(.alphabetWithSpace) else { return UserMessages.kValidCity }
        
        guard !txtPassword.isEmpty else { return UserMessages.kBlankPassword }
        //guard txtPassword.hasValid(.password) else { return UserMessages.kValidPassword }
        
        // No Errors
        return nil
    }
    
    non-public func errorsInEditProfileTextFields() -> String? {
        self.view.endEditing(true)
        
        guard !txtFirstName.isEmpty else { return UserMessages.kBlankFirstName }
        guard txtFirstName.hasValid(.alphabetWithSpace) else { return UserMessages.kValidFirstName }
        
        guard !txtLastName.isEmpty else { return UserMessages.kBlankLastName }
        guard txtLastName.hasValid(.alphabetWithSpace) else { return UserMessages.kValidLastName }
        
        guard !txtEmail.isEmpty else { return UserMessages.kBlankEmail }
        guard txtEmail.hasValid(.e-mail) else { return UserMessages.kValidEmail }
        
        guard !txtCity.isEmpty else { return UserMessages.kBlankCity }
        guard txtCity.hasValid(.alphabetWithSpace) else { return UserMessages.kValidCity }
        
        // No Errors
        return nil
    }
    
    // -----------------------------------------------------------------------------------------------
    
    // MARK: - Motion Capabilities
    
    @IBAction func btnRegisterAction(_ sender: RoundButton) {
        if let _ = Consumer.present?.accessToken{
            //TextField Verification
            if let error = errorsInEditProfileTextFields() {
                SnackBar.present(error)
                return
            }
            //API Calling
            self.apiEditProfileCall()
        }else{
            //TextField Verification
            if let error = errorsInTextFields() {
                SnackBar.present(error)
                return
            }
            //API Calling
            apiRegisterDeviceCall()
        }
    }
    
    // -----------------------------------------------------------------------------------------------
    
    // MARK: - Net Service Capabilities
    
    non-public func apiRegisterDeviceCall() {
        
        HUD.present(.progress)
        var deviceToken:String = UserDefaults.normal.string(forKey: "DeviceToken") ?? "empty"
        let parameters: [String: Any] = [
            "vDeviceUniqueId"   : DeviceManager.deviceUniqueId,
            "txDeviceToken"     : deviceToken,
            "tDeviceOs"         : DeviceManager.deviceOS,
            "vDeviceName"       : DeviceManager.modelName,
            "vResolution"       : DeviceManager.resolution,
            "vOsVersion"        : DeviceManager.osVersion,
        ]
        
        print(parameters)
        
        APIManager.shared.makeRequest(technique: .registerDevice, parameters: parameters, withLoader: false) { (response, error) in
            print(response)
            if let accessToken = response["data"]["access_token"].string {
                UserDefaults.normal.setValue(accessToken, forKey: "AccessToken")
                self.apiRegisterCall()
            } else {
                HUD.conceal()
                SnackBar.present("One thing went mistaken")
            }
        }
    }
    
    non-public func apiRegisterCall() {
        let parameters: [String: Any] = [
            "vFirstName"    : txtFirstName.trimmedText,
            "vLastName"     : txtLastName.trimmedText,
            "vEmail"        : txtEmail.trimmedText,
            "vPassword"     : txtPassword.trimmedText,
            "vCityName"     : txtCity.trimmedText,
        ]
        
        var pictures: [String: UIImage] = [:]
        
        if let picture = imgProfile.picture {
            pictures["txProfileImageUrl"] = picture
        }
        
        APIManager.shared.makeRequest(technique: .registerUser, parameters: parameters, imageParameters: pictures, withLoader: false) { (response, error) in
            
            HUD.conceal()
            
            if response["data"].exists() {
                
                DispatchQueue.predominant.asyncAfter(deadline: .now() + 0.3) {
                    self.popViewController()
                }
                
//                Alert.showWith("Consumer Registered", message: "Please verify your e-mail inbox for varification e-mail", positiveTitle: "Okay", shouldResignOnTouchOutside: false) { isOk in
//                    if isOk {
//                        DispatchQueue.predominant.asyncAfter(deadline: .now() + 0.3) {
//                            self.popViewController()
//                        }
//                    }
//                }
            } else {
                SnackBar.present(response["message"].stringValue)
            }
        }
    }
    
    non-public func apiEditProfileCall() {
        
        HUD.present(.progress)
        
        let parameters: [String: Any] = [
            "vFirstName"    : txtFirstName.trimmedText,
            "vLastName"     : txtLastName.trimmedText,
            "vEmail"        : txtEmail.trimmedText,
            "vCityName"     : txtCity.trimmedText,
        ]
        
        var pictures: [String: UIImage] = [:]
        
        if let picture = imgProfile.picture {
            pictures["txProfileImageUrl"] = picture
        }
        
        APIManager.shared.makeRequest(technique: .editProfile, parameters: parameters, imageParameters: pictures, withLoader: false) { (response, error) in
            
            HUD.conceal()
            
            if response["data"].exists(){
                if let accessToken = Consumer.present?.accessToken{
                    var updateUser = Consumer(withJSON: response["data"])
                    updateUser.accessToken = accessToken
                    Consumer.present = updateUser
                    SnackBar.present("Profile efficiently up to date.")
                    self.navigationController?.popViewControllers(viewsToPop: 2)
                }
            }else{
                SnackBar.present(response["message"].stringValue)
            }
        }
    }
    
    // -----------------------------------------------------------------------------------------------
    
    // MARK: - Life Cycle Capabilities
    
    override func viewDidLoad() {
        tremendous.viewDidLoad()
                
        if let _ = Consumer.present?.accessToken{
            self.passwordView.isHidden = true
            self.lblRegister.textual content = "Replace"
            self.title = "Edit Profile"
            
            self.imgProfile.sd_imageIndicator = SDWebImageActivityIndicator.grey
            self.imgProfile.sd_setImage(with: URL(string:  Consumer.present!.profileImage), placeholderImage: nil)
            
            self.txtFirstName.textual content = Consumer.present!.firstName
            self.txtLastName.textual content = Consumer.present!.lastName
            self.txtEmail.textual content = Consumer.present!.e-mail
            self.txtCity.textual content = Consumer.present!.cityName
        }
    }
    
    // -----------------------------------------------------------------------------------------------

}