• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Using NSWorkspace's launchedApplication to detect running App
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Using NSWorkspace's launchedApplication to detect running App


  • Subject: Re: Using NSWorkspace's launchedApplication to detect running App
  • From: Jean-Daniel Dupas <email@hidden>
  • Date: Sat, 13 Dec 2008 18:21:32 +0100


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@hidden)

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:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Using NSWorkspace's launchedApplication to detect running App
      • From: John Love <email@hidden>
    • Re: Using NSWorkspace's launchedApplication to detect running App
      • From: email@hidden
References: 
 >Using NSWorkspace's launchedApplication to detect running App (From: John Love <email@hidden>)

  • Prev by Date: setNeedsDisplay Equivalent for NSMenuItem?
  • Next by Date: Re: Using NSWorkspace's launchedApplication to detect running App
  • Previous by thread: Using NSWorkspace's launchedApplication to detect running App
  • Next by thread: Re: Using NSWorkspace's launchedApplication to detect running App
  • Index(es):
    • Date
    • Thread