Moving .lproj file inside Resources - objective-c

I'm trying to begin localization on a project, and I've already got an English version of Localizable.strings going. I'm now trying to add French to that file, which is creating an fr.lproj folder, as I'd expect. However, it's putting it in my project root, and I'd like it inside my project's Resources directory.
Xcode seems to have no interest in letting me move the file, and if I move it in Finder, it goes red in Xcode as expected, but doesn't let me click to locate the file.
I've tried moving it in Finder, then editing project.pbxproj in a text editor to add Resources/ in front of the only line in there that mentions fr.lproj/Localizable.strings, and that has worked, but after doing that, the project's targets also turned red in Xcode, and building the app doesn't change that fact. Very odd.. any idea what could be going on, or how to get this going?

This can be a real pain. I even had XCode crash on me when trying to correct unwanted file locations. I found that the best way is to create the localized file (be it .strings or .xib) as a copy of the source language version outside of XCode, then drag and drop it into XCode. If you do this then XCode will display it correctly and your targets' Build Phases > Copy Bundle Resources settings will include it with its correct location. I don't know why your targets are displayed in red, perhaps you could look under Copy Bundle Resources in case anything is wrong there, or also select your project and click Validate Settings in case you haven't already done so.
Also, if you have been testing in the simulator beware of how XCode does not clean up the files in your app bundle--you may want to delete the app and run it again to make sure it's working with your new location.

Related

Moving Project file in Xcode Interface Builder

I have somehow managed to get the Xcode project file for "My System" in a different folder from all the other project files. Everything works but is there an easy way to get the files together in one folder (ie. either by moving "My System.xcodeproj" into the lower folder or moving all the other files up with it in the higher folder.
If I made this change, what parameters I would need to change inside Xcode.
I'm using Xcode 11.3.1 on Mojave and Objective-C (no storyboard).
I'm not sure if it is worth moving these or whether I should just leave it.
File and Folder Structure:
The arrangement shown in your screen shot of the Finder is correct: a project folder, containing the project file (xcodeproj) along with a single folder that contains the actual code files. That is the standard. Don't mess with it.
Actually you shouldn't even look at it. Look at your project through Xcode, and let Xcode worry about where the files "really" are. Under no circumstances should you touch any of these files in the Finder or you will risk breaking the project entirely.

Xcode "Building" a Project

Honestly, I don't fully understand my question, but hopefully I can still be fairly clear about it.
I just wrote a simple project in Objective-C/Xcode. It looks like Xcode generated an executable in a folder called "Debug" and when I double-click on it, it opens a terminal window and runs fine. However, while running, it reads from a text file in the same directory that it's in. So if I want move the executable to a different location, I also have to move the text file to the same location or it won't be able to find the text file.
My question is... when I download an application on my computer (like Google Chrome or Evernote), it comes as its own file and I can place it in any directory I like; there are no associated files I have to move whenever I move the "executable". Is there a way to generate a clean application like this using Xcode?

Error cleaning build folder - You do not have required file permissions

I'm using xcode 6. Its fine to clean but it fails when I choose clean build folders.
Seems like you are restricted to create a build folder in your system root.
In XCode Menu --> Preferences --> Locations Tab --> Locations sub-tab, Change Derived Data to Relative and give any name in text box.
Have a look here which is also a permission problem in Xcode.
It could be due to Xcode bug (at least for me in Xcode 6.3.1). Toggling the location for derived data folder will fix it.
Go to Xcode > Preferences > Locations and change Derived Data to Relative, then back to Default.
Clean build folder again.
I just clean that folder in Finder, then all fine.
In Xcode 14 I clicked "Clean" command which had popped up in the 3rd row from the top and that fixed it.

Qt icons from resource file do not display

I made a user interface using Qt Designer qith Qt 5.0.1, and I used icons from a resource file. After compiling, the executable runs perfectly fine, and the icons are displayed as expected. However, when I run the programme on a different computer, they mysteriously disappear, and I am not able to get them back.
What can be the reason for this? I thought that the resources where hard-coded in the executable after compilation, but that may be wrong. In any case, I find it very peculiar that wherever I move the executable, it displays the icons on my own computer, but not on another one's.
I think you're missing some plugins. If you're using Windows and your icons are .ico type files, you need to copy the qico.dll file from the imageformats folder located somewhere in your Qt folder (something like C:\Qt\Qt5.0.1\5.0.1\mingw47_32\plugins\imageformats) to a subdir called imageformats that you create inside the directory that contains your deployed .exe file.

Files removed from Xcode project, but still available in game

My cocos2d-iphone project has tiled maps (.tmx files along with .png textures).
Recently, I deleted all the .png textures in my project (in Xcode, you hit the delete key and then choose to send to trash).
Then, I ran the project, and it tried to load up the CCTMXTiledMap. I was expected it to crash (there shouldn't be any textures in the project, anyway), but it didn't. In fact, it ran just fine, and the maps did load. No idea why - is Xcode keeping some kind of reference to such files somehow?
I checked the .tmx file, and this is the line that defines the source image:
<image source="myMap-hd.png" width="973" height="1024"/>
There definitely is no myMap-hd.png nor myMap.png file in my project folder. Not even Xcode's search toolbar shows it!
Oh, and I also cleaned the project.
As I wrote in question's comment. Problem was not in your Xcode project. Deleted resource files will most likely be still available on device/simulator if you had run application with these resources previously. The reason is that Xcode doesn't track files that are in application bundle, they're just simply copied. That's why they land in Copy Bundle Resources build phase.
You should delete application from device/simulator and run it again. Or if you have precious data already in application, you could navigate to application bundle and delete file manually. Files won't appear again.
In the simulator, iOS Simulator (menu item) > Reset Content and Settings. Clean your project, then run again. Same thing happens without cocos2D.
I've found this to be an issue when nib files are automagically loaded, and while not in the referenced files seem to still be loaded (or attempted). Can cause some brain pain bc the files don't appear in the Xcode IDE though they do exist in the file system.