0
サーバーでXMPPストリームに接続していますが、ユーザー名、パスワードが間違っていても接続は常に成功します。なぜこれが起こるのか理解できません。 私のアプリケーションでクライアント側を構成し、私のアプリケーションをXMPPサーバに接続したいと考えています。ヘルプは高く評価されます。以下は私のコードですXMPPサーバーとの接続とiOSのクライアント側の設定
import UIKit
import XMPPFramework
protocol ChatDelegate {
func buddyWentOnline(name: String)
func buddyWentOffline(name: String)
func didDisconnect()
}
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate, XMPPStreamDelegate, XMPPRosterDelegate{
var window: UIWindow?
var delegate:ChatDelegate! = nil
var xmppStream = XMPPStream()
let xmppRosterStorage = XMPPRosterCoreDataStorage()
var xmppRoster: XMPPRoster
override init() {
xmppRoster = XMPPRoster(rosterStorage: xmppRosterStorage)
}
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions:
[NSObject: AnyObject]?) -> Bool {
//setupStream()
self.xmppStream = XMPPStream()
self.xmppStream.addDelegate(self, delegateQueue: dispatch_get_main_queue())
self.xmppStream.hostName = "****softs-mbp-9"
self.xmppStream.hostPort = 5222
self.connect()
return true
}
func connect() -> Bool {
if !xmppStream.isConnected() {
let jabberID = "[email protected]****softs-mbp-9"
let myPassword = "**********"
if !xmppStream.isDisconnected() {
return true
}
// if jabberID == nil && myPassword == nil {
// return false
// }
xmppStream.myJID = XMPPJID.jidWithString(jabberID)
do {
try xmppStream.connectWithTimeout(XMPPStreamTimeoutNone)
print("Connection success")
return true
} catch {
print("Something went wrong!")
return false
}
} else {
return true
}
}
func disconnect() {
goOffline()
xmppStream.disconnect()
}
}
コメントがあります:) –
ええ、私は彼の投稿をコメントすることはできません。私は50人の弁護士を持っていません。 – Matak
let jabberID = "admin @ **** softs-mbp-9"そのユーザー名は – Mughees