Problems setting application icon with QT 5.3 on Mac - macos

I've been trying to set my application's icon following the directions here:
http://qt-project.org/doc/qt-5/appicon.html
If I understand correctly, the process should be fairly simple:
Create an icon file (FlySightViewer.icns) using iconutil. I followed the directions here: https://stackoverflow.com/a/20703594/443822.
Add ICON = FlySightViewer.icns to the .pro file.
However, when I follow these steps, the icon remains the default Qt application icon. I've tried deleting the app bundle and build folder, since I've read that these are sometimes not rebuilt through the usual process. This doesn't seem to resolve the issue.
Looking a bit deeper, when I run qmake from Qt Creator, the generated Makefile contains several instances of FlySightViewer.icns, including this line:
#$(COPY_FILE) ../flysight-viewer-qt/src/FlySightViewer.icns FlySightViewer.app/Contents/Resources/FlySightViewer.icns
The file ../flysight-viewer-qt/src/FlySightViewer.icns seems to be right where I expect it to be. However, when I build the project and look inside the app bundle, the icon is nowhere to be found. The only thing in the Resources folder is empty.lproj.
So it seems to me that the icon isn't appearing as expected because it is not being copied to the app bundle, but I have no idea why that might be.
Any help would be appreciated. I realize this is a fairly common question, but none of the answers I've found here seems to have helped.
Thanks for your time!

Add this line into .pro file:
QMAKE_INFO_PLIST = Info.plist
Then create the .plist and set the icon name there. I won't paste an example .plist because it's quite large, but you can see how it's done by right-clicking a random app and selecting "show package contents".

With older versions of Qt, I settled on changing the icon manually. However, the most recent version of Qt (or macdeployqt) seems to have fixed the problem, so I no longer need to set the icon manually.

Related

SceneKit: imported dae file not copied to app bundle

Got a weird scenekit asset problem... I’ve got an assets file (catalog.scnassets) that seems to be fine in Xcode. I’ve added to it a dae file which also opens fine in Xcode.
However, the file doesn’t seem to get copied into the app bundle when I build (mac app), even though the build logs show it happening:
copySceneKitAssets: Copy plants.dae
copySceneKitAssets: Running scntool on /Users/jason/Library/Developer/Xcode/DerivedData/FirstPersonGame-fxynipfnexmczbgnujwuiqxtiogd/Build/Products/Debug/FirstPersonGame.app/Contents/Resources/catalog.scnassets/plants.dae
When I check that directory in the build folder, catalog.scnassets is there, but it’s empty. Any ideas what might be going on?
Here’s what the file looks like in Xcode’s Identity inspector:
It’s simple!
I was seeing a bunch of warnings like:
scntool: warning: Could not load ModelIO.framework ((null)) (etc)
which led me to this StackOverflow post which solved it for me.
In short: check in Xcode Preferences -> Locations. For me, the “Command Line Tools” had nothing selected (somehow!), so selecting a value there (in my case, Xcode 10.1), then doing a clean build, fixed the issue.
Had the same issue on Xcode 11.3.1 but command line tools are set. Had to uncheck "prefer compressed textures" to make Xcode import the file. This will also make a json file to show up!?

In xcode it's impossible to add new files into the project

I found billions of questions and answers about this particular problem but none of solves the issue. I am following some tutorials to learn cocos2d game engine. In the tutorial i follow the tutor uses a windows machine and just puts the sprites he need under the Resources folder. Hovewer on my mac whatever i do theres no way the app will see that the image is there.
I tried dragging and dropping in the finder
using add file dialong from the xcode file menu
dragging from the finder and dropping into the xcode
None of these methods succeded in the end all the time i get the following error
Open the File Inspector by pressing Option-Command-1, then make sure your target is checked in the Target Membership section:
The Target Membership controls which targets the file is included in. Xcode will skip the file when building your target if your target is not checked, causing it to not be copied to your app.

How do you add an icon to a OSX console app with XCode 6?

I give up, I can't figure it out. I'm new to mac, and this is driving me insane.
The steps outlined here are not sufficient:
https://developer.apple.com/library/mac/recipes/xcode_help-image_catalog-1.0/chapters/AddingIconSets2.html
The result: the blocky "exec" icon.
What else do I need to do? The .xcassets files I created have been added to the "Copy Bundle Resources" build phase. However, the executable isn't any larger.
I also created an .icns file, and I was never able to get that to work either. I think these are deprecated?

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.

Xcode 4 code sense is not working

I am running a "old" Xcode 3 project in Xcode 4 and code sense is not working for my own classes. I have tried following:
Clean/rebuild
Remove Derived Data
Installing 4.3 documentation
Restart
Without any luck.
Sometimes the code sense works but mostly I just get "No Completions".
Try this:
Open Organizer then Project Tab.
Clear the "Derived Data". Xcode should re-index your project then and code sense should work. At least worked for me.
I know this is late, but for reference: http://sealedabstract.com/code/when-xcode-4s-code-completion-autocomplete-breaks/
Close the project, leaving XCode still running.
Open XCode’s Organizer window, go to the Projects Tab, select the correct project, and hit the Delete button next to “Derived Data”.
Quit XCode.
Navigate to your project’s .xcodeproject file in Finder. Right-click, choose “Show Package Contents.”
Leave the project.pbxproj file, but delete the project.xcworkspace file, any .pbxuser files, and the entire userdata folder.
Open the project in XCode. You will see XCode riding high on the CPU usage for around 10-60 seconds, depending on the size of your project. The activity window will say “Indexing”
When your CPU spike returns to earth, code completion will be working again.
There's a lot of deleting going on there so please be careful, but this definitely worked for me.
I've been doing this, and it's worked multiple times for me (after trying all of the above previously).
Edit: Now I just hit space, backspace (the mac version) and rebuild... works nice. Then, remember to scroll (sometimes the colors don't show up until you scroll somewhere)
Find your prefix file: "ProjectName_prefix.pch".
Comment out some line. (basically change it)
Build your project, doesn't matter if it fails or not.
Uncomment it.
Build again.
I'm betting only step 2 (modify the prefix) is what does it, but these essentially get you back to running. Suddenly everything magically recolors itself and completes functions.
Good luck if that doesn't fix it, perhaps try doing this to your dependency pch files (three20 or FB api's)
Clearing the "Derived Data" only works temporarily for me. I have to do it and then restart Xcode like 3-4 times each day to get code sense working again.
I found out the real cause is in the Target's Build Settings. I moved everything from Header Search Paths to User Header Search Paths and it is fixed. In my case, the framework I'm working with is RestKit.
BTW, I came up with this because I was adding another project (QuickDialog) into my project and I was curious that it is using User Header Search Paths, but not Header Search Paths. Here is the difference between them.
You can able to fix that issue by change build settings like this, PreCompile Prefix Headers :NO
FYI, if one file doesn't have code sense but the rest of your project does, check that its added to a target. Once I did that I got code sense back in that file.
It's been ages but the answer is just to move the code into a new folder and the code sense should be working now.
This happened when I added a new Objective-C Class and the code sense doesn't work only on the newly added .m and .h files (on XCode 4 latest update during this post).
Close all xcode windows
Delete all your projects from xcode>window>organizer and restart your project. It will now sense and index your project properly.
I wrote about it in detail here.
Basically my fix was that with localization. I upgraded from xcode 3.2.5 to xcode 4 and then screwed around with built in interface builder and turned on localization for a XIB file accidently which placed my source files in en.lproj directory. After moving them back to Classes folder it worked perfectly.
Again, for the sake of helping others with this issue which, in my case, happened upon upgrading to Xcode 4.3.
Of course I tried the solutions offered in this post, and none of them worked. But the suggestion to move the location of the project in Finder brought back some Code Sense, but the suggestions didn't make any sense.
I ended up deleting my project and re-cloned it from the git repository.That brougt back Code Sense for me...
I open a second project in the background whenever my Xcode's code sensing stops working (it usually works the first time i open the project but after a while code sense no longer works). So what i do is to open a second project in Xcode. Xcode will start indexing the second project and magically the code sense for my main project is back.
Running Xcode 4.3.1 on Lion
Hope this helps someone.
From this comment here I was able to debug the problem on my end, it seemed to be a bad -w flag that the clang preprocessor wasn't recognizing properly. Basically, running
defaults write com.apple.dt.Xcode IDEIndexingClangInvocationLogLevel 3
in Terminal increases the verbosity of the indexer, and should help you track down issues. Open Console.app and look for messages from Xcode, the search string IDEIndexingClangInvocation helped me find them.
For me it happened simply because the file had no target membership. If the first few answers did not work for you, go to your .m file (presumably it's this file that you're having trouble with), open the Utilities view (Edit -> Utilities -> Show File Inspector) and under "Target Membership" check the target to which you want this file to belong.

Resources