Debugging file associations of Electron app in MacOS - macos

Our Electron app uses electron-builder and adds file associations to MacOS when it is installed from a .dmg file. Setting the association works fine, but we don't seem to handle the 'open-file' correctly inside the app, as files don't load as expected.
Is there a way of working with file association and debugging the app at the same time? I know that I could change the code and add some console logs, build the .dmg file, install it, try it and repeat. But this workflow seems very tedious, so I'm looking for a simpler way of doing this.
Can I somehow manually register the file association for the dev version of the Electron app, so that it's enough to build it and then click on some files in Finder? Or can I trigger the 'open-file' event of my app manually?

Turns out it‘s enough to simply build the complete app package. If macOS finds an .app file somewhere on the disk, it is available in Finder‘s file associations.

Related

Trying to publish ASP.NET Core React app with Electron.NET

So my understanding from the documentation to perform a publish is I need to call 'electronize build /target win'. This builds the project. However, there are some issues I'm unsure how to address.
The content path when I try to run it says the content root is C:\Windows\system32 instead of the actual working directory where the .exe resides. That isn't correct. Any ideas why? I think some of the other issues are caused by this.
Edit: I found out #1 uses the correct directory if it is ran as administrator. Unsure why.
How does one hide the command menu that comes up? all i want is the electron window to show on publish.
I see an electron window come up like when i run 'electronize start' but not after publishing. Any ideas?
Please try the latest version of Electron.NET. During development, a development menu is displayed. A standard behavior of Electron if you not have your own menu. With a build, the development menu is hidden again.

Adding preferences to Mac app

I have created a Mac app, now I want to add a Preferences to this. I looked up and came to know that I need to use NSPreferencePane. I have created a separate Xcode project for this and it will get generate a .prefPane file. On running this it will ask whether to add to system preferences or not and adds it if selected.
How can I bundle my app and preferences together ?
If I package this as a dmg file should I put both .app anf .prefPane file in the dmg file ?
It sounds like you want to magically (or programmatically) copy the preference pane into the right place (~/Library/PreferencePanes or /Library/PreferencePanes).
If you're going to copy it into your user's Preference Pane folder (i.e. ~/Library/PreferencePanes), you should be able to simply copy it from your Application bundle into there.
If you want to copy it into a system-wide Preference Pane folder (i.e. /Library/PreferencePanes), you'll need to write a privileged tool or helper app that gets Administrator priviledges so it can do the copy. Creating these things is not the most trivial of tasks.
If you are not distributing via the Apple App Store, you could use an installer package to install both your application and your preference pane. The newest option from Apple is "productbuild", which is a command line tool. PackageMaker is Apple's older tool for creating installers, and you can get it as part of the Auxillary Tools for Xcode, available from the Downloads section of developer.apple.com, and there are a bunch of other installer-building tools you could use to ship your Preference Pane with your app, such as "Iceberg".
It would be much easier to simply add the preferences interface to the app itself.

Mac app is still running after deleting Info.plist

I want to build a Mac App from scratch. I manually created the required folders of main app, Contents, MacOS, Resources, and dropped the binaries. The only one I don't know how to create from scratch is "Info.plist". So, I just copied one from the installed Applications on my machine, removed all the unfamiliar keys, except the Executable and Package type (as APP).
Then I did a test. Before I copied and editted the Info.plist file, I double-clicked the app icon in Finder. Not working, which is expected. After I copied and editted the Info.plist file, it is working, which is also expected. Next is what I don't understand. I removed the Info.plist file, and double-clicked the app icon in Finder, it is STILL working!
My question is:
Did the first time running migrate the Info.plist information to some secret place in the app bundle?
Is copying and editing an existing Info.plist file from other applications a good practice for building an app from scratch?
I know the post is old but think to answer,so that users will get benefitted as they come across this.You asked two questions:-
1)See the first run has a build and its derived data might help you to run without Info.plist(for particular case although i didn't think so it run).
But you can't run app without info.plist.
2)No.the answer is copying and editing an existing info.plist from other application is not a good practice.
Every app and plug-in uses an Info.plist file to store configuration data in a place where the system can easily access it. OS X and iOS use Info.plist files to determine what icon to display for a bundle, what document types an app supports, and many other behaviors that have an impact outside the bundle itself.
For better knowledge about this you can see this link:-
https://developer.apple.com/library/ios/documentation/general/Reference/InfoPlistKeyReference/Introduction/Introduction.html
I think the user who asked this already got these things,Hope this will help other Users.
Thanks.

How to build screen saver in Xcode 4?

I'm making an OSX screen saver in Xcode (Objective-C, ScreenSaverView class, etc.), and it runs within Xcode correctly. When I navigate to the build output folder and double-click on the the .saver file, it opens System Preferences/Desktop & Screen Saver and asks if I want to install it. All correct.
But when I email the .saver file to myself and open it, System Preferences opens but not to Desktop & Screen Saver and no option to install it is presented. I think it may have to do with the fact that when I build it (with, as far as I can tell, build settings specifying "Release" instead of "Debug"), the output file is still in /Users/Me/Library/Developer/Xcode/DerivedData/ScreenSaver/Build/Products/Debug/ rather than a release folder.
What am I missing here? I have very little experience with configuring build settings, compiler flags, etc.
Edit:
For what it's worth, it seems to work if I compress the output .saver file as a .zip and email that instead. Not a great solution though.
As described in the comment above, apparently it's being built correctly; email messes up binary file attachments so to have it work correctly it should be encoded (e.g. by zipping it) before attaching.

Building Mac OS app - Hide files from 'Contents' folder

New to cocoa, so I'm probably asking a stupid question. When I build a MAC OS app, I can go view package contents, and under Resources I can see my nib files. Now, when I go and see contents of other apps, I don't see their nibs - like Chrome - don't see them! So, is there a way to build your app so so that certain files (nibs, .py files) can't be visible under Contents?
All files will be visible under Contents - I think that Chrome does not use nibs as it is cross platform and constructs its GUI directly from code.

Resources