Skype Desktop API delegate methods doesn't get called on Mac OSX

Discussion in 'Mac Programming' started by saqibjaan, Nov 15, 2012.

  1. saqibjaan, Nov 15, 2012
    Last edited by a moderator: Nov 15, 2012

    macrumors member

    Joined:
    Feb 1, 2012
    Location:
    Lahore
    #1
    I am trying to implement Skype Desktop API delegate methods on Mac OSX. But they didn't get called. My Skype version is 6.0.0.2946.

    (void)skypeAttachResponse: & (void)skypeNotificationReceived: doesn't get
    called.

    Here is my code:



    Code:
    #import <Foundation/Foundation.h>
    #import "SkypeController.h"
    
    
    int main (int argc, const char * argv[])
    {
        NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
    
        SkypeController *con = [[SkypeController alloc] init];
        
        [con applyCurrentState];
        
        sleep(1000);
        
        [con release];
            
        [pool drain];
        
        return 0;
    }
    
    
    
    @interface SkypeController : NSObject <SkypeAPIDelegate>
    {
        NSString *clientApplicationName;
    }
    
    
    @property (nonatomic, retain) NSString *clientApplicationName;
    
    
    -(void) applyCurrentState;
    
    @end
    
    
    
    #import "SkypeController.h"
    
    NSString* const cMyApplicationName = @"Saqib Skype Tester";
    
    @implementation SkypeController
    
    @synthesize clientApplicationName;
    
    
    -(id) init
    {
        NSLog(@"In constructor");
        
        self = [super init];
        
        if (self != nil)
        {
            [SkypeAPI setSkypeDelegate:self];
        }
        
        NSLog(@"Exit from constructor");
        
        return self;
    }
    
    
    
    // required delegate method
    
    - (NSString*)clientApplicationName
    {
        NSLog(@"In clientApplicationName");
        
        return cMyApplicationName;
    }
    
    
    
    -(void) applyCurrentState
    {
        NSLog(@"In applyCurrentState");
        
        if([SkypeAPI isSkypeRunning] && [SkypeAPI isSkypeAvailable])
        {
            NSLog(@"Going to connect");
            
            [SkypeAPI connect];
            
        }
        
        else
        {
            NSLog(@"Skype is not running or not available");
        }
        
    }
    
    
    - (void)skypeNotificationReceived:(NSString*)aNotificationString
    {
        NSString *message = @"skypeNotificationReceived: ";
        NSLog(@"%@", [message stringByAppendingString:aNotificationString]);
        
    }
    
    
    - (void)skypeAttachResponse:(unsigned)aAttachResponseCode
    {
        switch (aAttachResponseCode)
        {
            case 0:
                NSLog(@"Failed to connect");
                break;
            case 1:
                NSLog(@"Successfully connected to Skype!");
                break;
            default:
                NSLog(@"Unknown response from Skype");
                break;
        }
        
    }
    
    
    - (void)skypeBecameAvailable:(NSNotification*)aNotification
    {
        
        NSString *message = @"skypeBecameAvailable: ";
        NSLog(@"%@", [message stringByAppendingString:[aNotification
                                                                name]]);
        
    }
    
    
    
    
    - (void)skypeBecameUnavailable:(NSNotification*)aNotification
    {
        
        NSString *message = @"skypeBecameUnavailable: ";
        NSLog(@"%@", [message stringByAppendingString:[aNotification
                                                          name]]);
        
    }
    
    @end
     

Share This Page