2016-04-14 24 views
0

Merhaba xmpp Framework ile çalışıyorum. Ben benim bağlantı yönteminde günlüğüneios içinde xmpp akışı nasıl doğrulanır

SEND: <?xml version='1.0'?> 
2016-04-14 11:27:54:712 [1731:1807] SEND: <stream:stream xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams' version='1.0' to='172-31-21-148'> 
2016-04-14 11:35:08:592 [1731:650f] RECV: <stream:stream xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" from="172-31-21-148" id="58xfmkolyf" stream1:lang="en" version="1.0"/> 
2016-04-14 11:35:08:593 [1731:520f] RECV: <stream:features xmlns:stream="http://etherx.jabber.org/streams"><starttls xmlns="urn:ietf:params:xml:ns:xmpp-tls"/><mechanisms xmlns="urn:ietf:params:xml:ns:xmpp-sasl"><mechanism>PLAIN</mechanism><mechanism>ANONYMOUS</mechanism><mechanism>SCRAM-SHA-1</mechanism><mechanism>CRAM-MD5</mechanism><mechanism>DIGEST-MD5</mechanism></mechanisms><compression xmlns="http://jabber.org/features/compress"><method>zlib</method></compression><auth xmlns="http://jabber.org/features/iq-auth"/><register xmlns="http://jabber.org/features/iq-register"/></stream:features> 

RECV: <stream:features xmlns:stream="http://etherx.jabber.org/streams"><starttls xmlns="urn:ietf:params:xml:ns:xmpp-tls"/><mechanisms xmlns="urn:ietf:params:xml:ns:xmpp-sasl"><mechanism>PLAIN</mechanism><mechanism>ANONYMOUS</mechanism><mechanism>SCRAM-SHA-1</mechanism><mechanism>CRAM-MD5</mechanism><mechanism>DIGEST-MD5</mechanism></mechanisms><compression xmlns="http://jabber.org/features/compress"><method>zlib</method></compression><auth xmlns="http://jabber.org/features/iq-auth"/><register xmlns="http://jabber.org/features/iq-register"/></stream:features> 


<auth xmlns="urn:ietf:params:xml:ns:xmpp-sasl" mechanism="SCRAM-SHA-1">biwsbj05NTczNjM1MjY0LHI9MUMzNjhCODktMjZGNi00NjJFLUJBQTAtNDFCNDA5OEYzMDE4</auth> 
2016-04-14 11:41:42:545 [1731:622f] RECV: <presence xmlns="jabber:client" to="ip-172-31-21-148/58xfmkolyf" type="error"><x xmlns="vcard-temp:x:update"><photo/></x><error code="401" type="auth"><not-authorized xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"/></error></presence> 
2016-04-14 11:41:43:177 [1731:622f] RECV: <failure xmlns="urn:ietf:params:xml:ns:xmpp-sasl"><not-authorized/></failure> 
2016-04-14 11:41:47:547 [1731:607] SEND: <auth xmlns="urn:ietf:params:xml:ns:xmpp-sasl" mechanism="SCRAM-SHA-1">biwsbj05NTczNjM1MjY0LHI9REMzRkY3RDQtNEYxNy00RkVBLUE1OTktMjA3QTE5REJGQTNE</auth> 
2016-04-14 11:41:47:860 [1731:180b] RECV: <failure xmlns="urn:ietf:params:xml:ns:xmpp-sasl"><not-authorized/></failure> 

altına alıyorum girişiyle am ederken 172-" gibi gösteren gönderirken ne yapıyorum

- (BOOL)connect 
{ 

if (![xmppStream isDisconnected]) { 
    return YES; 
} 
myJID =[NSString stringWithFormat:@"%@@172-31-21-148",[[NSUserDefaults standardUserDefaults] stringForKey:@"userNameJID"]]; 

NSString *myPassword [email protected]"123456"; 


// If you don't want to use the Settings view to set the JID, 
// uncomment the section below to hard code a JID and password. 
// 
// myJID = @"[email protected]/xmppframework"; 
// myPassword = @""; 

if (myJID == nil || password1 == nil) { 
    return NO; 
} 


[xmppStream setMyJID:[XMPPJID jidWithString:myJID]]; 
password = myPassword; 

NSError *error = nil; 

if (![xmppStream connectWithTimeout:XMPPStreamTimeoutNone error:&error]) 
{ 

    UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Error connecting" 
                 message:@"See console for error details." 
                 delegate:nil 
               cancelButtonTitle:NSLocalizedString(@"O_K", @"OK") 
               otherButtonTitles:nil]; 
    [alertView show]; 

    DDLogError(@"Error connecting: %@", error); 

    return NO; 
} 


return YES; 

}

Ama akışı Jid olduğunu 31-21-148 "ama kullanıcı adı @ servername gibi olmalıyız. i özlüyorum nerede bana

cevap

0

İlk yardım lütfen, size aşağıdaki Yöntem kullanarak XMPP aktive etmek zorunda:

- (void)setupStream 
{ 
    NSAssert(_xmppStream == nil, @"Method setupStream invoked multiple times"); 

    // Setup xmpp stream 
    _xmppStream = [[XMPPStream alloc] init]; 


#if !TARGET_IPHONE_SIMULATOR 
    { 
     _xmppStream.enableBackgroundingOnSocket = YES; 
    } 
#endif 

    // Setup reconnect 
    _xmppReconnect = [[XMPPReconnect alloc] init]; 

    // Setup roster 
    _xmppRosterStorage = [[XMPPRosterCoreDataStorage alloc] init]; 

    _xmppRoster = [[XMPPRoster alloc] initWithRosterStorage: _xmppRosterStorage]; 

    _xmppRoster.autoFetchRoster = YES; 
    _xmppRoster.autoAcceptKnownPresenceSubscriptionRequests = YES; 

    // Setup vCard support 
    _xmppvCardStorage = [XMPPvCardCoreDataStorage sharedInstance]; 
    _xmppvCardTempModule = [[XMPPvCardTempModule alloc] initWithvCardStorage:_xmppvCardStorage]; 

    _xmppvCardAvatarModule = [[XMPPvCardAvatarModule alloc] initWithvCardTempModule:_xmppvCardTempModule]; 

    _xmppCapabilitiesStorage = [XMPPCapabilitiesCoreDataStorage sharedInstance]; 
    _xmppCapabilities = [[XMPPCapabilities alloc] initWithCapabilitiesStorage:_xmppCapabilitiesStorage]; 

    _xmppCapabilities.autoFetchHashedCapabilities = YES; 
    _xmppCapabilities.autoFetchNonHashedCapabilities = NO; 

    [_xmppRoster   activate:_xmppStream]; 
    [_xmppvCardTempModule activate:_xmppStream]; 
    [_xmppvCardAvatarModule activate:_xmppStream]; 
    [_xmppCapabilities  activate:_xmppStream]; 

    [_xmppStream setHostName:@"host.credencys.net"]; 

    [_xmppStream addDelegate:self delegateQueue:dispatch_get_main_queue()]; 
    [_xmppRoster addDelegate:self delegateQueue:dispatch_get_main_queue()]; 

    _allowSelfSignedCertificates = NO; 
    _allowSSLHostNameMismatch = NO; 

} 

ve sonra çağrı "Bağlan" yönteminden sonra ...

İlgili konular