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

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.

Related

Why the Resources direrctory is not visible on my project navigatior

I just started learning SwiftUI and trying to follow the steps of the Building lists and navigation example from Apple. Although copied and existing on the project directory, I noticed the Resources directory is not visible in my project navigation on Xcode.
The build is successful, but since the app tries to read landmarkData.json file from that directory, it throws:
Could not find landmarkData.json in main bundle.
Why doesn't the Resources show up on Xcode? How can I fix this issue?
Thank you so much
Here's some things you can verify :
Verify if the clock is selected in the search bar. If so, de-select it.
Try deleting the Ressources folder in your projet files. Then, drag and drop it in your files navigator (left panel in xcode).

How to add json file to Xcode project [duplicate]

I'm trying to add some new resource files to a project which was build by another person on another mac. I think that the project has the provision of the previous person.
Using right click->Add Files to "MyProject" doesn't provide the expected result. After I compile the project, the added file is not visible in the application.
How can I add new resources in my project?
PS: I'm trying to learn Objective-C in a macincloud.com account.
It might be that the file you added was not added to the project build. Click your project > App target > Build Phases
And check that the file exists in Compile sources (if it needs to be compiled), otherwise check Copy bundle resources. If the file does not exist there, drag it there and it should be fine, (from what I understand of your question).
EDIT
You can also check wether a file is added to the target by clicking the file and opening the "File Inspector" (View > Utilities > Show File Inspector, or ⌥ + ⌘ + 1), and check the Target Membership section.
Example:
Adding to Copy bundle resources worked for me
Just drag the resource file (from a finder window) into your project files area (left side) and drop in supporting files.
Once you drop, a dialog will prompt you which targets to add it for. Select all that are appropriate. Thats it.
Just had a similar experience with Xcode Version 11.7 (11E801a), which I mention as it may help others from wasting a day and a half.
In addition to the other answers explaining how to add the resources:
For me the problem was I had my resources listed in Developer Assets under the target's General tab, but also in the Build Phases/Copy Bundle Resources. This worked fine running through Xcode in simulators and even on devices, but when I came to Archive the app, the resources were not being copied. Deleting my resources from the Developer Assets list, but keeping them in Build Phases worked.
And in the end it turns out I only need the resources in the Build Phases section for either running through XCode or Archiving !

Problems setting application icon with QT 5.3 on Mac

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.

MonoDevelop is not generating IB outlets for my MonoMac project

I am getting back in to MonoMac, and straight away, experiencing problems.
I have added my outlets and actions to my XIB files, and linked them with IB controls, saved my XIB, and returned to MonoMac, and it is not regenerating the C# files, so the bindings are not linked - I cannot use them.
What happening? I am using the latest stable versions of everything (MonoMac did all its updates).
Thanks
This happens sometimes. I you are using a XIB file generated by MonoMac as default resources, you just need to close both MonoDevelop and Xcode, go to your project folder and clear the bin and object folders. Run the MonoMac, double click your XIB file, edit it in Xcode, press the Command+S buttons 2 or 3 times to make sure the files get changed so MonoDevelop will sync them, and your C# files will get generated...
But I had a situation that this didn't work and I couldn't figure it out and that was when I started an Empty MonoMac Project and added an Empty XIB file to it! The C# files do not get Sync after 5 tries and I didn't waste my time trying to fix it. Created a Document MonoMac project, deleted unneeded files and continued my work.
Hope it helps.

Problems adding Projects to Workspace in Xcode 4

I have a couple of projects that I had started under Xcode 3.2.x some time ago. I switched to Xcode 4 a few days ago and want to make use of the Workspace feature as both projects. Basically, my plan is to extract some common features out of the two projects and make them a common library that both projects depend on. However, before I even get to the tricky bit of dependencies I get stuck just adding my two projects to the workspace.
I tried creating a new workspace and selecting "Adding files to " from the context menu; I then select the .xcodeproj file from my first project and it appears in the left-hand side tree browser in my workspace. However, it's just the file, not the project that I get. That is, rather than getting a two-line entry in the tree browser where the first line states the project name and the second line says something like "1 target, iOS SDK 4.3" like in the Apple documentation, I get a single line simply stating the name of the .xcodeproj file including the extension. There is also no triangle on the left to expand the node. It's like I just dragged some file in the workspace, not a project. The same goes for the second project.
I have also created a new Project "Foo" from scratch in Xcode 4 and added it to my workspace, with the same result. I looked at Apple documentation and watched the 16 second video about a dozen times now, but cannot work out what I am doing wrong (if the problem is indeed in the chair and not in the computer).
I had this exact same problem. I think it stems from having another workspace already open referencing the project you want to add. I got it working by:
shutdown xcode completely
double-click the workspace to launch Xcode and open just that workspace
drag and drop the project file from the Finder
Worked fine. I have many workspaces all referencing an openssl project, and it seems to work OK when you only have one workspace open at a time in Xcode.
Actually, I made it work without exiting Xcode.
All you have to do is make sure the projects you want to add are closed, since Xcode is having trouble adding open projects to a workspace.
So:
Close the projects you want to add
In the Workspace window, choose "Add Files to MyWorkspace"
Add the .xcodeproj file of the project you want to add
I had the same problem. SO I just exit xcode, restart it. Then I can see the files under the project.
Exiting Xcode completely and then double-clicking the .xcodeproj file to open the project.
It works but when you add an activity to the project than r.java file is automatically removed and errors are coming.

Resources