Quickblox + Swift 3.0 iOS SDK 错误:未找到应用程序和 QBConnectionZoneTypeProduction
Posted
技术标签:
【中文标题】Quickblox + Swift 3.0 iOS SDK 错误:未找到应用程序和 QBConnectionZoneTypeProduction【英文标题】:Quickblox + Swift 3.0 iOS SDK Error: No Application Found and QBConnectionZoneTypeProduction 【发布时间】:2017-05-03 14:04:43 【问题描述】:我正在尝试创建一个基本的 QBRequest 并登录一个用户,或者至少得到一个用户不存在的错误。我在控制台中收到此错误。
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)
我检查了语法并完成了正确包含 SDK 的所有步骤。它继续说:“未找到应用程序”。我检查了我的凭据,并在 appDelegate 中正确输入了所有内容。
我在尝试设置 Endpoints 自定义时也收到错误消息:Xcode 一直告诉我:QBConnectionZoneTypeProduction ia a use of unresolved identifier..
应用代理:
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
【问题讨论】:
【参考方案1】:正确的解决方案如下:
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
所以只需将 QBConnectionZoneTypeProduction 替换为 .production 这是因为 Swift3 引入了命名更改。
【讨论】:
以上是关于Quickblox + Swift 3.0 iOS SDK 错误:未找到应用程序和 QBConnectionZoneTypeProduction的主要内容,如果未能解决你的问题,请参考以下文章
如何在 quickblox (Swift, iOS, xcode) 中实现发送图片
Swift 3、iOS 10+、xCode 8.3+、Quickblox - 在保持纵横比/视频分辨率的同时切换全屏远程流