• 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: How to deactivate an app
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to deactivate an app


  • Subject: Re: How to deactivate an app
  • From: "Gerriet M. Denkmann" <email@hidden>
  • Date: Wed, 01 Feb 2012 01:40:11 +0700

On 31 Jan 2012, at 17:18, Ken Thomases wrote:

> On Jan 31, 2012, at 1:55 AM, Gerriet M. Denkmann wrote:
>
>> I have an app A, where I can select a word and press a button.
>> This starts (or activates) another app called B, which displays some information about this word.
>
>> But if there is no information about the word, app B should make app A active again.
>> But how?
>> (B should not be hidden; it should remain visible, so that the user sees: "Word not found".)
>
>> There probably is a simple, direct and obvious solution. But I cannot see it.
>
> There isn't, as far as I know.  The best general-purpose solution I'm aware of is for app B to track activations of other apps using Carbon events (kEventClassApplication , kEventAppFrontSwitched).  Then, use that info to switch back to the last activate app.
>
> I suppose, these days, you can also key-value observe the runningApplications property of [NSWorkspace sharedWorkspace] to learn when apps come and go, and then key-value observe the active property of all of the NSRunningApplication objects in that collection to track which was last active.  That doesn't seem like much of an improvement over the Carbon events approach, though.
>
> However, your case seems more specific.  Are both apps A and B ones that you're writing?
Yes, they are.

> Can't you just switch back to app A directly, if it's the only thing that will be invoking app B?

> Or have I misunderstood your case (in which case, maybe you could clarify).
App B offers a service "look up word".
And app A uses this service.

While usually it is app A which uses this service, it could be really any app which displays text.

Lee Ann Rucker's solution looks interesting, but would not work between any app and B.

Ideally the service mechanism should have an argument like "pid of sending app" but there is (as far as I can see) none.

Probably I have to watch for these Carbon events you have mentioned.

(Just tried these Carbon events. This is a royal pain, because of non-existence of any documentation.
And the switching back does not work, if A (using services) did start B. But this is a minor inconvenience.)


Kind regards,

Gerriet.


_______________________________________________

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: How to deactivate an app
      • From: Lee Ann Rucker <email@hidden>
References: 
 >How to deactivate an app (From: "Gerriet M. Denkmann" <email@hidden>)
 >Re: How to deactivate an app (From: Ken Thomases <email@hidden>)

  • Prev by Date: On iOS5 simulator and device, NSDateFormatter doesn't show time zone abbreviation for "Asia/Kolkata" for the "z" or "zzz" specifier.
  • Next by Date: Re: iCloud On OSX - Cannot save changes
  • Previous by thread: Re: How to deactivate an app
  • Next by thread: Re: How to deactivate an app
  • Index(es):
    • Date
    • Thread