I am developing one simple chat application using XMPPFramework from robbiehanson. I have installed eJabberd server in my system and created some users. I set hostname = "localhost" and tried to login with that user credentials. It is successfully logged in. When I change the hostname ie hostname="talk.google.com". I cant able to login. I got "Sign-in attempt prevented" mail and
<failure xmlns="urn:ietf:params:xml:ns:xmpp-sasl"><not-authorized></not-authorized></failure>
FYI,
- (BOOL)connectWithUsername:(NSString*)username WithPassword:(NSString*)pwd
{
if (![xmppStream isDisconnected]) {
return YES;
}
// NSString *myJID = [[NSUserDefaults standardUserDefaults] stringForKey:kXMPPmyJID];
//NSString *myPassword = [[NSUserDefaults standardUserDefaults] stringForKey:kXMPPmyPassword];
NSString* myJID=username;
NSString* myPassword=pwd;
//
// 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.
//
// Replace me with the proper JID and password:
// myJID = @"[email protected]/xmppframework";
// myPassword = @"";
if (myJID == nil || myPassword == nil) {
NSLog(@"JID and password must be set before connecting!");
return NO;
}
[xmppStream setMyJID:[XMPPJID jidWithString:myJID]];
password = myPassword;
NSError *error = nil;
if (![xmppStream connectWithTimeout:100 error:&error])
{
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Error connecting"
message:@"See console for error details."
delegate:nil
cancelButtonTitle:@"Ok"
otherButtonTitles:nil];
[alertView show];
NSLog(@"Error connecting: %@", error);
return NO;
}
[self goOnline];
return YES;
}
Am I need to register app in Google Developer Console? Kindly provide me the solution to integrate Gmail account in the XMPPFramework.
check it
– Bista