• 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: Switching app type from background only to full UI, and back?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Switching app type from background only to full UI, and back?


  • Subject: Re: Switching app type from background only to full UI, and back?
  • From: Jim Wintermyre <email@hidden>
  • Date: Thu, 4 Nov 2010 23:36:47 -0700

At 7:01 AM +0100 11/5/10, vincent habchi wrote:
Le 5 nov. 2010 à 01:46, Jim Wintermyre <email@hidden> a écrit :

I have an app that needs to always be running in the background. Most of the time it is just a faceless daemon, but for some complicated reasons, sometimes it needs to display various windows, and I can't easily factor out these UI elements so that the UI part is handled by a regular app (and IPC with the background server is used).

Why don't you split your app in two, with the daemon launching, when appropriate, the foreground interface as a separate process, and manage some means of communication between the two (Cocoa based or not...)

I can't because of the "complicated reasons" I referred to. Some of the UI windows currently have to be displayed from within the background process context, and I can't easily (or possibly at all even with lots of work) separate them out.


I doesn't look like there's a way to do what I really would like to be able to do, so now I'm looking at some other alternatives:

- I could start the app in background-only mode on startup. It remains that way until the user does something that requires the background app to display a window. At that point I use TransformProcessType to make it a foreground app. But now I can't go back once the user has closed all the windows. At this point the user still sees the app in the dock and app switcher, and can easily quit the app, which is bad (app needs to always be running the "server" part of its functionality).

- I could turn on LSUIElement and always run the app in the background. Whenever the app needs to display a window, it launches a separate proxy app which shows up in the dock and app switcher. The purpose of this app is solely to manage window focus issues. So, to the user, it would appear that any windows coming from my background app actually "belong" to this proxy app. Whenever on of my windows is clicked on, I need to bring the proxy app to the foreground, and then bring all my windows to the foreground. When my app goes to the background, whatever windows the new foreground app has come to the foreground as usual. If the user then activates my app via the app switcher or whatever, it would have to tell the background app to activate my windows. Basically this would be trying to kinda fake what the OS normally does automatically. These kinds of hacks usually seem fraught with strange bugs... but I don't have a better idea at the moment.

Jim
_______________________________________________

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: Switching app type from background only to full UI, and back?
      • From: "email@hidden" <email@hidden>
References: 
 >Switching app type from background only to full UI, and back? (From: Jim Wintermyre <email@hidden>)
 >Re: Switching app type from background only to full UI, and back? (From: vincent habchi <email@hidden>)

  • Prev by Date: [iPhone] How to make UITextView show spell suggestions on top rather than under the text
  • Next by Date: Re: Switching app type from background only to full UI, and back?
  • Previous by thread: Re: Switching app type from background only to full UI, and back?
  • Next by thread: Re: Switching app type from background only to full UI, and back?
  • Index(es):
    • Date
    • Thread