Base Internationalization and "Could not find a storyboard named […]" - xcode

I am using iOS 6 and trying to use base internationalization. But when I flip the switch and run, I get a "Could not find a storyboard named […]" exception.
I tried removing and adding the storyboard file both from the build phases and from the project itself to no avail. I notice in the build phases, that the storyboard is there but it is red.
Is there a trick to get this working?

Select the red storyboard entry in your project navigation, go to the file inspector use the button beside the file name to navigate to the file on disk:
<-- the button at bottom right
If this is not enough or not possible try these strategies:
Clean project, holding down the shift key (this will clean the entire directory).
Restart Xcode.
Check the target in the file inspector rather than setting it in build phases.
Try to verify that the file is not corrupted. (Change something in IB and save.)

Related

Problems after upgrading to Xcode 10: Build input file cannot be found

I upgraded my Xcode SDK to version 10 last night and then find I cannot build.
I'm getting this error:
Build input file cannot be found:
'/Users/call01/Library/Developer/Xcode/DerivedData/Comp-Lite-Apps-gytvmossqptokeafrddvvmnlzadk/Build/Products/Debug-iphoneos/SG11.app/SG11
which did not exist before my upgrade and I'm tempted to revert back but would like to stick with version 10 if I can resolve this issue.
Try to switch back to the Legacy Build System (File > Project Settings > Workspace Settings > Legacy Build System)
For Swift files or files that belong to the project such as:
Build input file cannot be found: PATH/TO/FILE/FILE.swift
This issue can happen when files or folders have been removed or moved in the project.
To fix it:
Go in the project-navigator, select your project
Select Build Phasestab
In Compile Sources section, check for the file(s) that Xcode is complaining of
Notice that the file(s) have the wrong path, and delete them by clicking on the minus icon
Re-add the file(s) by clicking the plus icon and search in the project.
Product > Clean Build Folder
Build
You generally find these missing files in the Recovered References folder of Xcode in the project tree (look for the search bar at the bottom-left of Xcode and search for your complaining file):
Deleting them from this folder can also solve the error.
For me In Xcode 10, this solution worked like a charm. Just go to the Recovered References folder and remove all files in red color and add it again with proper reference.
If Recovered References folder was not found: Check for all missing files in the project (files in red colour) and try to add files references again.
Just check the path to .plist file in Build Settings of your target
Funnily, closing Xcode and reopening it might also be enough.
This worked for me in Xcode 10:
Click Project icon/name in your Xcode project
Go to General tab
Click [Choose info.plist File] under Identity section
Select the info.Plist file
Check Info tab to see if info.plist was loaded successfully
Build and run
This is an architecture problem. Do not change to legacy build system!
I got the same error, but what solved it for me was this:
The top says architectures in VALID_ARCHS are also excluded in EXCLUDED ARCHS. I was messing around with them to get a Swift Package to compile in Xcode 12, and have spent hours on this.
It would compile on the simulator and not on a device.
The Solution:
Go to Build Settings
Ensure "Architectures" contains 1 entry : $(ARCHS_STANDARD)
Ensure there is nothing in "Excluded Architectures"
Now scroll right to the bottom of Build Settings.
Make sure the VALID_ARCHS is exactly the same as this screenshot.
The arm stuff is $(ARCHS_STANDARD) again.
If VALID_ARCHS doesn't exist, add it with the + button.
Clean (cmd-shift-K)
Your project should now build perfect on both the simulator and device!
If it doesn't work, you need to make sure all these settings are the same both in your target build settings and the project build settings.
Note, if you have a Mac with Apple silicon, you may not need to do any of this.
The above solution eventually works for me; however, I need to do some more extra steps to finally make it to compile successfully. (These extra steps were required even on Xcode 9.)
Xcode: File -> Workspace Settings -> Build System: Legacy Build System
Xcode: Product -> Clean
Rotate to compile thru different emulator types, such as "iPhone 8", "iPhone 8 Plus", etc. (They might fail or might not.)
Eventually compile on "Generic iOS Device"
I fixed this issue this way: go to your project's Build Phases (click on project icon at the top, and then click on Build Phases). Search for your file there. If it's there (it'll be grayed out), delete it. Then clean (shift + alt + command + k), and run! Hope it helps.
If the error says it can't find Info.plist and it's looking in the wrong path, do the following:
Select your project from the navigator, then select your target
Select "Build Settings" and search "plist"
There should be an option called Info.plist File. Change the location to the correct one.
None of the above worked for me, but this did:
Open project in Finder, right click on your .xcodeproj file and show package contents
Open project.pbxproj in a text editor
Find the reference to your missing file
Edit path = "path/to/file.swift" to the actual location on disk and save the file.
Rebuild the project
In my case I had a build script that generated the .app binary (Buck).
The Buck build script ran in parallel with Swift Embed build step. Because the .app binary was not generated yet the Swift step would fail.
In my build script I added "$BUILD_PRODUCTS_DIR/$EXECUTABLE_PATH" under "Output Files".
This tells Xcode's New Build System that this script will output the app Binary and in turn Xcode will make sure to synchronize any build steps that depend on this artifact.
I ran into this error after renaming a file. Somehow Xcode didn't correctly rename the actual file on disk.
So it wasn't able to find the file. Sometimes the files gets highlights with a red text color. At other times the Swift icon in front of the file was getting a gray overlay.
The fix was simple.
Look into the error and see exactly which file it's unable to find.
Select the file that can't be found.
Go to the 'File Inspector'. It's on Xcode's right navigation pane.
Click on the folder icon.
Select the correct file.
Clean build and run it again.
Open the right navigation pane where your project files exist
OR JUST click on cmd + 1. Then search for "Recovered References" folder. Open it and delete all red files, then everything will work so fine.
I had this happen for building my unit tests. This may have happened because I deleted the example tests.
I removed the Unit test bundle then re-added it as shown in the pictures below and all was well again.
I had a similar issue after upgrading to a new swift version recently.
Moving files around caused my xcode project to reference items that were no longer in the project directory giving me the Error Code Build Input File Not Found.
In my situation I somehow had multiple files/images that were being referenced as described below:
In the image above.
Navigate to your Targets page.
Then Click on the Build Phases tab on the top.
Scroll Down to Copy Bundle Resources
Find the affected files and remove them. (hit delete on them or select them and hit the minus button )
It was in here that I somehow had multiple files and images that were being referenced from other folders and the build would fail as they could no longer find them. And I could not find them either! or how Xcode was still referencing them
I hope this helps someone else !
This worked for me
try deleting the red colored files
delete the files in derived data
clean the build folder
then try building by using "new build system" from file->workspace settings
I had the same issue. The problem was that I didn't have any file under the Target > Build Phases > Compile Sources. The problem was solved after I added at leas one file to Compile Sources.
Not that I did anything wrong, but I ran into this issue for a completely different reason and kinda know what caused this.
I previously used finder and dragged a file into my project's directory/folder. I didn't drag into Xcode. To make Xcode include that file into the project, I had to drag it into Xcode myself later again.
But when I switched to a new branch which didn't have that file (nor it needed to), Xcode was giving me this error:
Build input file cannot be found:
'/Users/honey/Documents/xp/xpios/powerup/Models
Extensions/CGSize+Extension.swift'
I did clean build folder and delete my derived data, but it didn't work until I restarted my Xcode.
In my case, the file (and the directory) that XCode was mentioning was incorrect, and the issue started occurring after a Git merge with a relatively huge branch. To fix the same, I did the following steps:
Searched for the file in the directory system of XCode.
Found the errored file highlighted in red (i.e, it was missing).
Right clicked on the file and removed the file.
I tried building my code again, and voila, it was successful.
I hope these steps help someone out.
What Xcode was complaining about was a XIB file I got it working by going to Project -> Build Phases -> Copy Bundle Resources, removing the "problematic" XIB, cleaning (CMD+Shift+K), building and adding it back again.
There is also one possibility that sometimes when you move your files to different folder and especially when you move your info.plist to other folder, you need to define the location of that file. To solve this problem, simply click on your project blue icon on the top, and you will see a button in place of project name and bundle id, click on it and locate the info.plist file there, clean and compile happily.
I ran into this problem soon after upgrading to Xcode 10, but that was not the issue.
I tried changing the build system, but that gave me a separate error that meant the same thing. Generally saying "File X can not be found".
There are multiple things to check when a file can not be found.
Recovered references Folder
Apple does this nice thing where if it detects a reference to a file that doesn't exists it will add this reference into a group called "Recovered References"
That is nice of Apple but it doesn't always work.
Build Phases Compile Sources
In this list, there could be meta data for a file that the project is suppose to compile, but the file does not actually exists and it's attempting to find the file at the given path. In this list it will be dimmed out, delete them and re-add them by toggling the file's target dependencies or manually removing it and dragging it in.
File's Path
Double check the file path that the error is printing out and the file path for the file in finder. You can easily see this by clicking on the file in Xcode and checking the "Show the file inspector" tab (the left most tab). If these paths are correct then you are good!
Dimmed out files in your project that are not in recovered references or red
This one pissed me off because it's not obvious about what happened, but basically if you go into finder and move a file to a different location with out updating the reference in the project it will throw the error as the file no longer exists there. The only indication I have found for that is that the file in the "Project Navigator" tab (left most tab) is very slightly dimmed, but when you go to delete this file Xcode doesn't prompt you to delete the reference or send to trash. You can fix this by deleting the file and re-adding it to the project or going to the "File Inspector" tab and click the folder icon next to the path and change it to the proper location.
Either way, the error indicates that it can't find a file, switching to the old build system is a bandaid for a more concrete issue. We as developers understand that a compiler just wants an artifact to be listed at the end of a file path. Somewhere the path is not correct! We have to find where that is!
My issue was resolved with item 4 listed above. Hope this helps somebody.
In my case I accidentally deleted one third-party xcodeproj folder I used in my app.
If you tried profiling, and then it didn't work, and now you cannot build, go into your Target pane (via the Project Icon), Switch to the Build Settings tab, search for PROFILE - and set CLANG_USE_OPTIMIZATION_PROFILE to "No".
In my case, I had created a new test target and deleted the default swift file so it was left with just the info.plist. Adding a new file fixed this.
The "Legacy Build System" solution didn't work for me. What worked it was:
Clean project and remove "DerivedData".
Remove input files not found from project (only references, don't delete files).
Build (=> will generate errors related to missing files).
Add files again to project.
Build (=> should SUCCEED).
I know that this is an old subject, but I found the issue with xcode 12.3 and was related to an error while doing the CopyPlist of the main.Storyboard during compilation.
Actually, changing the build settings to "Legacy Build Setting" worked, but it is deprecated, so I discarded it because is a short term solution.
Check this:
With that setting, worked for me. Before I had "Copy plist".
After struggling with this issue for about 45mins, here is a super easy solution that worked for me.
On the project explorer, click on the file/folder that is in red colour (means project is not able to locate the file)
Look at the details tab in the file inspector (generally to the right of the screen - see the attached screenshot)
Click on the folder icon and locate the real file/folder in your local machine.
That is it. This should do the trick. Basically help your xcode locate the directories and update the reference cache.
Random, for Cocoapods: I hadn't added my test target to my Podfile.

Edit GUI without using base internationalization

I set my Xcode 5 project to use a build target of OSX 10.6, unchecked "Use Autolayout" for MainMenu.xib and followed this answer to turn off base internationalization. This resulted in my MainMenu.xib file being removed from my project. When I build and run my project the window layout is how I left it, but going into finder, opening MainMenu.xib in Interface Builder and changing it's layout does not effect my project when I go to build and run it again.
How do I change the GUI for projects set to a build target of 10.6?
Can be added again to the project by:
Drag MainMenu.xib from Finder to the project files panel in Xcode.
A dialog will open, select copy items (if needed), created folder references, and add to the project's target (not "test"), click Finish and it should work!
If a more complete answer is added, I will best answer it instead of my own.

How can I deep clean Xcode?

I tried to update my cocos2d template and now I'm getting:
cocos2d: CCFileUtils: Warning HD file not found: bgs-jungle-hd.png
cocos2d: CCTexture2D. Cant create Texture. UIImage is nil
cocos2d: Couldnt add image:bgs-jungle.png in CCTextureCache
I tried product -> clean, product -> clean build folder, delete app from device, restart Xcode, but same issue.
I then opened a backup that was running well with older cocos2d and it crashes because of same issue. The file is spelled correctly in all places. There is nothing wrong with my code.
How do I super clean Xcode of all data and history?
When your app cannot open a resource, always check two things first: first, that you didn't misspell file name or used wrong capitalization (on device file names are case-sensitive), and second, that this file isn't missing from "copy resources" build phase.
To check that your resources are added to "copy resources" build phase:
In project navigator click on topmost item (your project's name). This will take you to project settings. Select your target, click "Build Phases", open "Copy Bundle Resources" phase. It will list all resource files which will be copied to your app's bundle. You can add missing files with "+" button in the very bottom of the list.
Alternatively, if you select a file in project navigator, in file inspector in right sidebar you can set target membership for this file. Usually checking target for a resource file will add it to that target's "copy resources" phase.
I have also experienced this problem. When you add resource folders, choose way
"Create folder references for any added folder"
do not choose
"Create groups for any added folders"
Hope it will be helpful :)

How to tell Xcode where my info.plist and .pch files are

I renamed my project and it's files and now Xcode is still looking for the old info.plist file. Where do I set the locations of the .plist and .pch files that it needs.
In my Project Info window, under Packaging there's an item for Info.Plist file, but it was blank, and when I try different paths, nothing happens. On compile it still says it can't find the plist by the old name.
I know this answer is answered and closed, but I'm going to add my discoveries here as it is slightly different for Xcode 4.2:
Select your project
In the left side of the middle pane, select your app under "Targets"
Select the tab "Build Settings"
Search the following keywords: "info.plist" and "pch"
At this point it should be pretty clear which are the ones you need to modify.
Click on "Validate Settings" and you're done.
Found it.
It was in the settings for the Target.
Choose Target in the Groups and Files pane on the left.
Right-Click and choose Get Info
Search for "Info.Plist" and type in the filename for the correct plist file into the property of the item named "Info.Plist File".
Then search for "Prefix" and find the item named "Prefix Header".
Change it's property to the name of the correct .pch file that you are using.
I think these different "Info" windows are confusing. You have to make sure the right file is selected in the Groups and Files pane before selecting "Get Info", and it's hard to tell if what you're doing is actually making changes to the Info.plist file, or where your changes are being saved.
For Xcode 10.1 when rename or move info.plist to sub folder.
Select your project
Choose targets
In General tab under Indentity you can specify new info.plist file
One more wrinkle to this. It still would not find the new plist file because it was in a folder inside the main project hierarchy on my disk. In this case, the name you should put in the build settings is relative to the project file, like "FolderName/Info.plist" for example.
Just close project and reopen it. Then you will see on the project target, choose plist button on the General tab See this screenshot to make sense
From XCode 11 onwards, the updated path for Info.plist has to be changed under Target -> Build Settings -> Packaging -> Info.plist File.
Please read here for further details
I know this is an old post, but I just ran into this same problem using Xcode 8.2. I had already duplicated .plist and .storyboard files in finder, but my Xcode project did not pick them up. In order to add files to your xcodeproj just right click on the project or folder in the Project Navigator and select Add Files to "Your Project Name". You should be able to select the files you need (use Cmd key to select multiple individual files).
If you created a new .plist or .storyboard file you'll need to link to your target membership. To link just click on the file in the navigator and on the right hand side in your standard editor > file inspector > target membership select the appropriate target membership.
The correct way to do this without duplicating files in finder is by selecting the file to duplicate and then going to File > Duplicate on the Xcode navigation menu.
I am working with Xcode 9.3 and "boldly" changed my app name without understanding that I was inviting trouble: I got it.
Fortunately, it is now easy to rename a project or app with reliable results if in Xcode you select the blue icon on the left/in the project navigator and then edit the "Identity and Type" "Name" field in the "File Inspector". This brings up a dialog, and clicking on "Rename" works reliably.
Xcode 14
Chose your Targets -> Build Settings -> Packaging
Find key "info.plist File" and update path like "AppName/FolderName/Info.plist"
enter image description here

In Xcode, how to exclude a file with a set name from being put in the app bundle

When I start an Xcode project I drag in a blank readme.txt file that I use to take notes with while I'm figuring things out. The thing is, the file gets put in the app bundle at build time. Then I have to deselect it in the Detail view so that won't happen.
Is there a way to automatically exclude a file with a known name from every build?
I know Xcode is automatable, but I don't know where to look.
Using the latest non-beta Xcode version.
In the project outline view (by default this is the left hand pane when you open Xcode) locate your application under the 'Targets' section. Expand the subheadings, one of which will be 'Copy bundle resources'. You will probably find your unwanted text file has been placed here automatically. Highlight the file here and delete it - this will leave the file in your project but will prevent Xcode from copying it to your App bundle when you perform a build. To finish off, select 'Clean & Build' from the Xcode build menu to clear out your old bundle completely and recreate it with your new setting.

Resources