so I have a class with the following interface:
#import <UIKit/UIKit.h>
#import "XMPPStream.h"
@interface SignInViewController : UIViewController
@property (strong, nonatomic) IBOutlet UITextField *UserNameTextField;
@property (strong, nonatomic) IBOutlet UITextField *PassWordTextField;
@property (strong, nonatomic) XMPPStream *myStream;
- (IBAction)SignInButtonPress:(UIButton *)sender;
@end
Then, if the SignInButtonPress
Method is evaluated, I have this code:
- (IBAction)SignInButtonPress:(UIButton *)sender {
self.myStream = [[XMPPStream alloc]init];
[self.myStream addDelegate:self delegateQueue:dispatch_get_main_queue()];
NSString *jid = self.UserNameTextField.text;
jid = [jid stringByReplacingOccurrencesOfString:@"@" withString:@"(at)"];
self.myStream.myJID = [XMPPJID jidWithString:self.UserNameTextField.text];
//stream.jid = self.UserNameTextField.text;
self.myStream.hostName = @"myAWSDNS.us-west-2.compute.amazonaws.com";
NSError *error = [[NSError alloc]init];
if ([self.myStream connectWithTimeout:0 error:&error] == YES)
{
NSLog(@"DId Connect!");
//[self performSegueWithIdentifier:@"Move" sender:sender];
}
else
{
NSLog(@"ou");
}
}
self.myStream connectWithTimeout
seems to run fine, error is nil
after the call, and I get "Did Connect" in the log.
However, even though I added self as a delegate of the xmppStream
(see beginning of method), the delegate method
-(void) xmppStreamDidConnect:(XMPPStream *)sender
does not get called, even though I have it implemented in the same class as:
-(void) xmppStreamDidConnect:(XMPPStream *)sender
{
if ([sender authenticateWithPassword:self.PassWordTextField.text error:NULL] ==YES)
{
NSLog(@"authed!");
[self performSegueWithIdentifier:@"move" sender:sender];
}
else
{
}
}
Why is the method not being called, and how can I troubleshoot and/or fix this?