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.
Related
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.
How can I tell which frameworks are embedded in a given framework (Xcode 12)?
Like is there some kind of tool that you can use to introspect into a framework and see what other frameworks are in there?
Specifically, I'm interested to determine what gets adde if you run "carthage copy-frameworks" with no files specified in the input scripts. In our app there are a few places we do this, and it seems to be adding frameworks that weren't explicitly specified. I just want to know where they're being added.
If you're just interested in the frameworks that are copied during compiltion you can have a look in 2 places:
The folder in which your app is built: $HOME/Library/Developer/Xcode/DerivedData/<app-specific-id>/Build/Products/Debug-iphoneos/.
Your built ap itself, which sits in the same folder I mentioned in 1.. You can right-click it and select Show Package Contents. Then under Frameworks you see all the frameworks linked to your app.
Get to your apps folder by opening Xcode > Products in the file naviagtor and select Show in Finder when right-click on your app there.
Yes, my problem really is that simple. How the heck do I get my app to use the icon file or asset catalog?!
System info:
Xcode 6.1.1 (6A2008a)
app target OS X 10.10
OS X 10.10.1 (14B25)
This is my first OS X app but I have several years' experience developing iOS apps.
Steps to reproduce:
open Xcode, start an entirely new cocoa application project
not sure this matters, but i specified my new project not to use storyboards or core data
drag a .png file from my local directory into the project structure, and make sure (a) it ends up in the build target and (b) the file copies into the project's directory
drag the png into the Images.xcassets catalog under any/all of the sizes classes for AppIcon.
build and run
Expected: app in dock and tab-switcher has the new icon.
Actual: app in dock and tab-switcher has the default "blank page with instruments A on it"
Ok, maybe that's a DEBUG thing.
archive the project, show in finder
Expected: app in Finder has correct icon
Actual: nope. It should be noted however that Xcode's Organizer shows the correct icon, and there does exist a file Contents/Resources/AppIcon.icns. Contents/Info.plist specifies that the Icon File is "AppIcon".
grrr. Let's try without the asset catalog.
in the target's General settings, under App Icon, select "don't use asset catalogs"
delete Images.xcassets
In Info.plist, in the line for Icon File (CFBundleIconFile), specify the icon's name (in my case "AppIcon"). The documentation clearly states that
The system looks for the icon file in the main resources directory of the bundle.
File extension is not required here.
build & run. also archive, to save time later.
Expected: app icon in dock and tab-switcher is correct.
Actual: nope
Expected: archived app has correct icon.
Actual: nope, but the archived product did have the correct png file in Contents/Resources.
What am I missing?!
I've tried this with .png app icons and a regular .icns file (generated by Xcode via an asset catalog). I've tried excluding and including the file extension in the Info.plist. Why is this so difficult?
Edit: Clean, Clean Build Folder and deleting the Derived Data folder did not help.
So I found the answer through the help of a commenter: I had to fill all of the xcassets/icns slots with images of the exact dimensions.
I'm currently translating my application (Mac OS X app) into another language. I've done almost all translations, but now I'm stuck on a pretty strange thing:
I have an additional window for the applications settings and translated the GUI elements the same way I did it for the main window. I imported the translations into my project which seemed to work fine because I can use the preview windows, switch the language of the assistant editor to German and see that the dialog will be localized correctly.
But as soon as I run my application (with "German" as language) and open the settings dialog the whole dialog is still in English (the base language).
The settings dialog's XIB file is located in the base.lproj folder and the corresponding .strings file is located in the de.lproj folder (which should be correct as the preview shows the correct translations).
I don't know what's going on and have no clue what might be the issue.
Does someone have any clue?
I'm using Xcode 6.1.1
I found the reason for this issue: Localizing the settings dialog forced Xcode to move it into the Base.lproj folder. But instead of moving the file Xcode just copied it into that folder - so the XIB file for the dialog existed twice and Cocoa used the old one (which was not localized).
After cleaning the build directory and deleting the derived data for the project the localization works fine now.
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.