Specifically, in his case, wouldn't it be:

aDictionary valueForKey:@"NSApplicationName"] isEqualToString: @"MyApplication"

?

Quoting Jean-Daniel Dupas <[email protected]>:


Le 13 déc. 08 à 18:14, John Love a écrit :

I do not understand why this code completes with the specified application not being active .. when it really is? I really need your help.

        BOOL         AppActive = NO;
        NSWorkspace  *workSpace;
        NSArray      *runningAppDictionaries;
        NSDictionary *aDictionary;

        workSpace = [NSWorkspace sharedWorkspace];
        runningAppDictionaries = [workSpace launchedApplications];

        for (aDictionary in runningAppDictionaries) {

                if ([aDictionary valueForKey:@"NSApplicationName"] == @"My 
Application") {
                        AppActive = YES;
                        break;
                }

        }

        return AppActive;

Thanks ...

Because operator overriding does not exists in Obj-C and so, == is a
pointer comparaison and not a string comparaison.

use the isEqual: method to compare two object.


_______________________________________________

Cocoa-dev mailing list ([email protected])

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/jmunson%40his.com

This email sent to [email protected]



_______________________________________________

Cocoa-dev mailing list ([email protected])

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to