简体   繁体   中英

Quickblox + Swift 3.0 iOS SDK Error: No Application Found and QBConnectionZoneTypeProduction

I am trying to create a basic QBRequest and login a user or at least get an error back that the User doesn't exist. I am getting this error in the console.

NSErrorFailingURLKey=https://api.quickblox.com/session.json,
NSLocalizedRecoverySuggestion=
{"errors":{"base":["No application found"]}},
com.alamofire.serialization.response.error.data=<7b226572 726f7273 223a7b22 62617365 223a5b22 4e6f2061 70706c69 63617469 6f6e2066 6f756e64 225d7d7d>,
NSLocalizedDescription=Request failed: client error (422)

I have checked the syntax and gone through all the steps to correctly include the SDK. It continues to say: "No application found". I checked my credentials and everything is entered correctly in the appDelegate.

I am also receiving an error while trying to set up the Endpoints customization: Xcode keeps telling me that: QBConnectionZoneTypeProduction ia a use of unresolved identifier..

appdelegate:

     func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
            FIRApp.configure()

            //Quickblox config
            QBSettings.setApplicationID(myAppIdInt)
            QBSettings.setAuthKey("myAuthKeyString")
            QBSettings.setAuthSecret("myAuthSecretString")
            QBSettings.setAccountKey("myAccountKeyString")
            QBSettings.apiEndpoint("https://api....quickblox.com", chatEndpoint: "chat....quickblox.com", forServiceZone: QBConnectionZoneTypeProduction)

            // Set settings for zone
QBSettings.setApiEndpoint("https://api...quickblox.com", chatEndpoint: "chat...quickblox.com", forServiceZone: QBConnectionZoneTypeProduction)
            // Activate zone
            QBSettings.serviceZone = QBConnectionZoneTypeProduction


            // iOS 10 support
            if #available(iOS 10, *) {
                UNUserNotificationCenter.current().requestAuthorization(options:[.badge, .alert, .sound]){ (granted, error) in }
                application.registerForRemoteNotifications()
            }
                // iOS 9 support
            else if #available(iOS 9, *) {
                UIApplication.shared.registerUserNotificationSettings(UIUserNotificationSettings(types: [.badge, .sound, .alert], categories: nil))
                UIApplication.shared.registerForRemoteNotifications()
            }
                // iOS 8 support
            else if #available(iOS 8, *) {
                UIApplication.shared.registerUserNotificationSettings(UIUserNotificationSettings(types: [.badge, .sound, .alert], categories: nil))
                UIApplication.shared.registerForRemoteNotifications()
            }
                // iOS 7 support
            else {  
                application.registerForRemoteNotifications(matching: [.badge, .sound, .alert])
            }

            return true
        }

A right solution will be the following:

QBSettings.setApplicationID(myAppIdInt)
QBSettings.setAuthKey("myAuthKeyString")
QBSettings.setAuthSecret("myAuthSecretString")
QBSettings.setAccountKey("myAccountKeyString")

QBSettings.setApiEndpoint("https://api....quickblox.com", chatEndpoint: "chat....quickblox.com", forServiceZone: .production)

// Activate zone
QBSettings.serviceZone = .production

So just replace QBConnectionZoneTypeProduction with .production This is because of Swift3 introduced naming changes.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM