OSX How to display only one icon in dockbar for same application launched from 2 different locations - objective-c

I have an application with FinderSync extension support.
I want to achieve silent update for this application. The only approach that I came up with at this moment, is installing the new version of the app into ~/Library/Application Support/../..., and whenever clicks the app from /Applications, redirect the user to Application Support one.
That means I will end up with two versions for the same app. One in /Applications and the other one in Application Support.
I have some issues after launching the application from both above locations.
If the user first starts the App from /Applications, selects Keep in dock, closes the app, updates the app by copying the new app to App Support and after that starts the app from App Support, I will end up with two dock icons.
Whenever I start the application, the FinderSync extension is automatically installed by the OS. It can be viewed in System Preferences->Extensions. Once the user quits the app and deletes the bundle, the OS automatically deletes the extension, so is no longer available in Extensions pref pane. However if I opened the application from both above locations, deleting the app from /Applications does not remove entirely the FinderSync extension from Extensions pref pane. Only after I remove the second application(the one from App Support), the FinderSync extension is removed from Extensions pref pane.
Are there any ways to overcome the above issues?
Please note that I have another question posted on a similar topic, while attempting to get rid of the above behavior using another technique, but I gave up using that approach a while ago:
OSX two dock icons for same application
Thanks

Related

Testing Mac App Store app on real device - How to export?

I have been developing Mac App Store and iOS apps for several years now. I don't event want to know how many hours, days or weeks (?) I spend by solving provisioning problems...
One of my Mac apps targets OS X 10.7+. While everything works fine in genereal, after the last update some users reported problems when using the app on 10.7. Other OS X version work fine.
In the past, I simply cloned the project from my developing computer (iMac) to my MacBook running the specific OS X version. I then opened the project in Xcode, ran it and check what the problem was. This is far to easy for Apple, since this not possible any more.
The project only compiles (due to several reasons) in Xcode 7+ only. Xcode 7 runs on 10.10+, thus testing on 10.7 is not possible.
I have been trying to build/export the app to test it on my MacBook the whole day without any success. The app simply does not start on 10.7 on my MacBook. Of course the MacBook is a registered devices, included in my provisioning profiles, etc.
This is my workflow:
Removed all App Store specific entitlements from the app in Xcode/Target/Capabilities
Created new wildcard certificates and provisioning profiles that does not include any App Store specific entitlements
Selected the new profiles in Xcode/Target/Build Settings/Code Signing
Run Product/Archive
In Organizer select the Archive and click on Export
Here I tried several different combination (signing, no signing, etc.). No matter if I choose Export a Developer-Signed Application or Export as a Mac Application the result is always the same.
When I copy the created App file to my MacBook und start it nothing happens. The icon flashes once and this is all. Only the Console gives I hint about the Problem:
killed com.mycompany.myapp because its use of the com.apple.developer.team-identifier entitlement is not allowed.
Great... As explained I removed all entitlement from the app and from the profiles. Where the hack does this entitlement come from and how do I get rid of it?
Is there no way to test the App with all its features (== all entitlement) on another device?
I should have answered my own question earlier. Back in January I was somehow able to get the app running on my other Mac. Now I had to solve the same problem and it took some time to dig out the correct solution again.
So, maybe this will help others to solve the same problem. At least it will help my future-me to remember what has to be done :-)
Archive the app just as you would prepare the app to be submitted to the App Store.
Switch to the Organizer and select the just created archive
Select Export... instead of Upload to App Store...
Select Export a Developer ID-signed Application(second option). DO NOT select Export a Development-signed Application (third option). Actually I have no idea what's the difference is, but only the first one works...)
Click Next and the Organzier will fetch provisioning information from your dev account. DO NOT select the fetched provisioning profile but select Use local signing assets from the dropdown box instead
Click Choose and Export in the next step.
Done
Good luck and happy app signing...

Terminate and replace app with earlier version to do upgrade install

I'm a newbie in Mac OSx & Objective-C development.
I'd like to ask some help on how to terminate as well as replacing an existing app (with an earlier version) when a later version of the app is being installed or upgraded?
I am aware about updating an app when a new version is available in the App Store or an external server. I've got that covered already. But this one is an implementation for a mac with no internet connection. Upgrading is done manually by installing the app whenever there's a new version available.
Behavior when installing:
It should check if there's an existing copy of the app in the system. It should prompt the user to continue and remove the app or cancel the installation.
If an existing copy of the app is currently running, it should prompt the user to quit the running copy of the app or cancel the installation. When the user selects to quit the app, it should automatically terminate the app and continue with the installation. The app with the previous version should be replaced by the newly installed copy of the app with the later version.
Any help would be much appreciated.
The PackageMaker can do all of this for you. Prepare an installer using this app by Apple. If you are using Mountain Lion then download it from
https://developer.apple.com/downloads "Auxiliary tools for Xcode"
Launch the application and click the edit button in the actions tab below preinstall actions.
In the sheet that is presented add the Quit application action.

iOS Application update with one Localization language removed

I'm working about one application for iOS. Application is already on App Store. But in new version, I have to remove one from Localization languages (Germany). After this, i observed very strange behaviors: When i deploy application on my phone without old version previous application, then everything is okay - if i has iOS set to Germany, application is in English. But when i deploy it when old version is already installed, then application does not show English translation, but only keys form unexisting Germany version ("terms_header" and so...).
My question is: How application will behave, when i send new version to App Store, and users will updates their phones to new version of my application?
When you update the application on any iOS device, it's bundle resources always get updated. However you can test the scenario using
- Install old application from xcode with localization
- Test if localization is working properly
- Update application with new build from xcode
- Re-test the application by changing language.
During updates only user generated data stay intact and bundle resources get updated.
What happens if you remove the application from the organiser and then reinstall it?
Ok, i found it. There is the way to check, how application will behave when is updatet from App Store:
Remove application from device
Generate Archive from old version of your app via Xcode (Product->Archive)
Distribute archived application as Ad-Hoc Deployment
Repeat points 2 and 3. for NEW version off your application.
Put .ipa file with old version of your app into iTune.
Install it on you device via iTune and synchronize device.
Check old version of application on you device.
Put .ipa file with new version of your app into iTune.
Press "Update" in iTunes, and synchronize device.
Check new version of application on your device.
In this case, my application is works.

Strange Issue: Application does not show in Main Menu after installation

I am developing an application for Symbian S60 V3. The application can be run properly on Simulator on PC. It can be transferred to Phone. On Phone, it can be clicked to installed. But after installation, I cannot find the installed application for running. It just disappear.
Is there any hint ?
Did you create the application with user interface? If it's just some bacjground process without icon and GUI then it won't be visible.
Did you check under Applications link (or Installed or whatever it is called in different systems).
Do you see your app listed in Settings -> Application Manager?

Distributing a pref pane which includes a background app on the Mac App Store

My app is a pref pane which includes a background application in its bundle.
I wonder if anybody has already figured out the best practice for distributing a "pref pane only" app via the Mac App Store. Are there already any pref pane apps in the store?
Apple states apps containing preference panes are not "self-contained", they install code or resources in a shared location that is not allowed by the guidelines hence in violation of both 2.15 and 2.30 in https://developer.apple.com/appstore/mac/resources/approval/guidelines.html
Let me start by saying that I have not submitted any apps that contain system preference panes (in fact I have not submit any apps to the Mac App Store, only the iOS App Store). This answers is based on my reading of the guidelines and my understanding of how OS X works.
I've read the Mac App Store guidelines and I don't see that they preclude system preference panes. 2.15 says:
Apps must be self-contained, single application installation bundles, and cannot install code or resources in shared locations
Finder treats a .prefpane file like any other file - Finder launches the app which handles files of this type (i.e. System Preferences.app) and opens that app and passes the file as an argument. When a .prefpane file is opened System Preferences.app asks the user were to install it (in the System Library or the Users Library). It is System Preference.app that is 'installing' the .prefpane.
If an app were to include a .prefPane in its bundle and a mechanism for allowing the user to open file in Finder then I do not think the above guideline would have been contravened.
I find it hard to believe that Apple wants developers to cluttered up users menu bars with unnecessary icons when they have already provided a much better solution.
I'd like to know if anyone has tried to submit an app that provides an option to install a system preference pane. I'd also like to know if I've missed some documentation from Apple which discuss this (besides the guidelines quoted above).