Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

saqibjaan

macrumors member
Original poster
Feb 1, 2012
48
1
Lahore
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
 
Last edited by a moderator:
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.