File in IOS bundle is not found in the simulator - ios

I am working on an ios 6.1 application, that uses cocos3d, i have a file that is
certainly in the bundle, which is 'CC3TexturableMaterial.vsh', but at a point in
time when the applications needs that file, it crashes and shows the following error:
[***ERROR***] Could not load GLSL file '/Users/macbook/Library/Application Support/iPhone Simulator/6.1/Applications/3505ADEC-C70B-490F-9011-A433D85C2D66/3D.app/CC3TexturableMaterial.vsh' because it could not be found
Which implies that the file is not in the simulator's .app.
does anyone encountered a similar problem?

This can happen when the file isn't explicitly being copied to the bundle.
To check this, ensure that it appears within the "Build Phases" -> "Copy Bundle Resources" section within your project's build settings. (To view the main build settings, select "Project" -> "Target" from within the left hand pane).

Just open terminal
pod deintegrate
and then
pod install

Just Follow Below Step:
1)Select your project from the left panel.
2) Select the target and then select Build Phases
3) There you should fin a button called Add Build Phase (Bottom right side)
4) There will appear a box where you have to select the files (there's a little +sign). And be sure you selected Destination: Products directory
Build the project, run it and now it should work !!

Related

Unable to find style.json when Implement Google Maps Styling JSON for iOS [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 !

set up Swift-Clean to use its features

i get this warning on main storyboard
xcode Version 7.2 (7C68)
warning: You have to install and set up Swift-Clean to use its features!
You (or someone for you) installed Swift-Clean (www.swiftcleanapp.com) into your project and forgot to add the preferences that Swift-Clean needs in order to check your code.
If you want to use Swift-Clean, you need to go to www.swiftcleanapp.com/survey.php, take the survey and download the .plist file that you'll insert into your project. Build the project; Swift-Clean will show you warnings if your code isn't compliant with the rules you specified.
If you want to delete Swift-Clean from your project, simply go to your target preferences (Project navigator > project name > select your target) and go to "Build Phases". You'll find a "Swift-Clean Run Script" Run Script Phase. Delete it by clicking on the "x" on the right side.
Also, to use Swift-Clean as it's automatically configured, the .app bundle needs to be in the Application folder.

Interface Builder could not open the document ".storyboard" because it does not exist

This problem is getting me really crazy. Xcode is looking for a storyboard in my project in a differente location from my project. I tryed removing the file, adding it again, cleaning the project, etc but didn't have luck.
This is the error.
cd /Users/fmartin91/Projects/loovin/loovin-ios
setenv IBSC_MINIMUM_COMPATIBILITY_VERSION 7.0
setenv PATH "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
setenv XCODE_DEVELOPER_USR_PATH /Applications/Xcode.app/Contents/Developer/usr/bin/..
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/ibtool --errors --warnings --notices --minimum-deployment-target 7.0 --output-format human-readable-text --compile /Users/fmartin91/Projects/loovin/loovin-ios/Build/Products/Debug-iphonesimulator/loovin.app/Base.lproj/LOOVProductIndex.storyboardc /Users/fmartin91/Projects/Base.lproj/LOOVProductIndex.storyboard
/* com.apple.ibtool.errors */
/Users/fmartin91/Projects/Base.lproj/LOOVProductIndex.storyboard:
error: Interface Builder could not open the document
"LOOVProductIndex.storyboard" because it does not exist.
I could fix this bug by killing ibtoold:
$ sudo killall -9 ibtoold
Why does ibtool need a daemon anyway?
Your storyboard is not in NSBundle mainbundle.
this problem is probably due a "Copy Bundle Resources" in "Build phases" problem.
For corrected it verify if your storyboard file is in "Copy Bundle Resources" for all targets. On project navigator select the project file select Build phases tab and check it is.
When you upload your file to google drive without zip, it appends the extension of .storyboard to .xml automatically and hence when you download it obviously the file won't exist.
To solve this issue, go to the:
[project folder] > [Project folder] > [Base.lproj]
There would be a .storyboard.xml extension type of file which you would have to rename it to the .storyboard extension. And hence your work is done.
Story board error solving visual guide:
I had a very similar problem and it took a few hours to resolve. Clearly xcode locked itself in some strange state that the project explorer could see the xib file while the compile could not. Finally this got resolved when I changed the Location in the File Inspector from Relative to Group to Relative to Project. I got this by comparing the project.pbxproj file in a regular text editor to search for any clues.
I encountered this same issue and here's how I resolved it:
Save a copy of the affected file outside of the project
Delete the file from the project, selecting Move to Trash to completely delete the file and reference from the project
Edit ProjectName.xcodeproj/project.pbxproj to remove all lines referencing the affected file
Re-add the file, making sure to check Copy items into destination group's folder (if needed)
Clean and build
I just ran into this issue running Xcode 9.2. I had copied my files from a school computer onto google drive and then downloaded them at home.
When I opened the files at home it kept telling me main.storyboard and the launch storyboard did not exist. The two storyboard files would display as xml, so they clearly existed, but even right clicking to "open as" produced nothing. After much troubleshooting I found a fix that worked for me.
SOLUTION:
Open your project folder, then the next folder named the same as your project. Open Base.lproj and you will see your two storyboards in xml format. Copy both the files, paste them into the same folder, delete the .xml and confirm the change to .storyboard. Do this for both files and you're set!
This happened to me after a git merge. I changed some storyboard localized files from one project to another and Xcode seems to keep on searching the file in the old project.
My solution was:
Edit the OldProjectName.xcodeproj/project.pbxproj
Search for the Storyboard name
Delete the references to the Storyboard name that appear followed by localization stuff (things like "Base.lproj", "es.lproj", etc)
Delete also the following localization entries (because they refer to the Storyboard file)
Clean and build
Repeat if other files keep throwing compile errors
For me I use xcode 10,
Click on the your project name (blue icon on left) > Build Phases > Under Copy Bundle Resources
Find the file, remove the duplicates if it’s there. Clean project and run again
I encountered same problem when moving the project to another computer. I followed below steps to solve this issue:
Open previous Main.storyboard file as Source Code, copy all
Create a new Main.storyboard file, Open as Source Code, paste
Delete previous Main.storyboard
Clean and build project.
In my case I found that the storyboard was placed in a group that referenced a folder that did not exist in the "Identity and Type" panel.
Removing that group and the storyboard, and adding it back referencing an existing folder solve the problem for me.
For me resetting the container folder of Main.storyboard file worked
I resolved this by doing this:
Open your Xcode project folder in finder, then find the file that you can't open.
Drag that file to your file path in Xcode Project (Inside Xcode App) like this.
Thick "copy item if needed" and choose "create folder references" and then click finish.
Restart Xcode
I could solve my issue, i really don't know how i did it but the things i tried were cleaning and building the project like a billion times, i hope this will be of help to anyone.
I just experienced this, and fixed it by restarting the darn computer. I found out more about it, though. In my case, my ibtool scripts weren't working, giving file-not-found errors just like yours. However I noticed a change in behavior when I ran them as sudo:
2013-09-20 20:49:40.339 Interface Builder Cocoa Touch Tool[58454:303]
CFPreferences: user home directory at
file:///var/root/Library/Application%20Support/iPhone%20Simulator/User/
is unavailable. User domains will be volatile.
Subsequent commands would fail or return without doing anything. So! ibtool/Interface Builder/whatever is somehow using some other launching service to run itself, with some other username or privileges.
Could it be that I installed some tool updates for Xcode 5.0, and it screwed up whatever serving process was running? Yes it could :)
I experienced the same situation with Xcode 7 beta 5. Rebooting my Mac did the trick.
Goto Build Phases > Copy Bundle Resources > Check for the Storyboard for which you are getting error > It should be displaying as blurred > If YES then delete its reference and add it again > Compile again.
In my case, folders in the project navigator and finder were not formed exactly the same. The Main.storyboard was in \Views folder in the project navigator but not in finder. Xcode wouldn't let me quit the app, because Main.storyboard couldn't be saved.
Here's what I did, that solved this problem:
Identify which files are missing or misaligned in your project navigator and finder simultaneously.
Copy Main.storyboard and other files that are not in their right place to a safe location.
Force quit Xcode from Activity Monitor. Reopen Xcode.
Paste previously copied files in finder. Make sure that the folder order is the same as the Xcode project navigator.
In Xcode, from project navigator right-click to where you need to add files and click add new files.
Add files from the finder.
Clean and build.

I need to run XCode 4.3 project twice in order to launch the cocos2d application

it drives me crazy, that my cocos2d project runs every second time on the device.
Every other time it says "Finished running " without launching the application.
My os version is 10.7.3 and I run xCode 4.3.
Other projects seems to work fine.
Any ideas?
BR,
Marcin
There were two Info.plist files under Resources folder. One of them was also under Copy bundle Resources tab in Build Phases section of the target.
I don't know how this happen, however I deleted one of the plist files, then removed it from the Copy Bundle Resources tab and now the project runs every time.
I found the second file while I was inspecting the whole project file by file. XCode does not report, that something goes wrong. I simply saw two files with the same name in Project Navigator pane.
Okay, I found a way to automatically do this.
Click the project icon, go to target, go to Build Phases tab, and at the bottom you should find the Validate Settings button. Click it. A window will show with an option to clean the "multiple references" of a resource. Use that, and XCode will do the rest.

move xcode project causes red text (missing files from project)

When I move iphone project directory to a new path.
There are some red texts indicate the missing files from the project source codes.
How to avoid these?
Here is how to locate the missing (red) files using the Xcode 4 interface:
Select the file or files in the left hand Project Navigator (the folder icon)
In the right sidebar click on "File Inspector" which is the leftmost icon resembling a page
In the "Identity and Type" section, there is a grey box labeled "Location".
Click on the small icon to the lower left that resembles a file browser - this will come up with a file browser to locate the file.
Voila, you are done.
Xcode 7
1.) Right click on the red (missing) file.
2.) Select "Show File Inspector"
3.) Look at the right hand side of the screen under "Identity and Type" between "Location" and "Full Path"
4.) Click on the folder icon to the right of the file name.
5.) Navigate to the file's new location in the pop-up window and select the file.
I encountered this issue when copying my project from one mac to another.
The solution for me:
assuming your files are grouped (in folder)
from xcode open the group in file inspector
The group will probably be missing the absolute path.
press the little icon nearby to pick the folder to associate the group with.
restart xcode to see the changes.
I had the same problem, when I changed the permission on the files/folders to everyone read/write they then appeared in Xcode.
This worked on a Pod project. Quit XCode.
rm -rf project.xcworkspace/xcuserdata/*
Restart XCode and reopen project.
In Finder, create a duplicate of the project directory just in case all goes squiffy.
In Finder, open the project directory that contains all the files with red references
For all the red files you see in XCode, except the info.plist file (see step 5 below), highlight them in Finder and drag them from Finder to XCode's project navigator. i.e. import them.
In XCode's "Choose options for adding these files" window: a) Select Copy items into Destination's group folder (if needed)
b) Select Create groups for any added folder
c) Select Add to Targets, and press Finish
Highlight and drag the info.plist file from Finder to Project Navigator and repeat step 4 WITHOUT selecting Add to Targets
If you had groups in Project Navigator (e.g. Supporting Files), reorder the files to be in the right places.
Delete the original bad red references in Project Navigator, and Cmd-Shift-K to clean for good measure.
Build and run on a device to remove the bad reference to the .app file
you just have to locate the missing file press in file icon in the identity and type you will find the full path just locate your file where do you move it click the file icon
When you create these files be sure to save in your app directory. Or if you import classes from other project be sure to check the copy option.
I dont know if this is the main reason but when you are importing files to the application, do you mary the "Copy items in to destination group's folder (if needed)" ?
this make sure the file is not only referenced but added to your project folder and ir will move any where you move your project.
Did you move files in to folders directly in your project folder and not in xcode?
This worked on a Pod project.
go into finder and project.
right click on your project .xcworkspace and click show package contents
right click on contents.xcworkspacedata and open with textEdit then make sure file path is correct. If project has been moved this can change
I also did this below but now sure if you need it
Quit XCode.
rm -rf project.xcworkspace/xcuserdata/*
Restart XCode and reopen project.
If you create an Xcode project, then move the .xcodeproj file or the newly created project folder to a different folder using Finder, subsequent builds may show many missing files which still reference the original folder locations (which no longer exist because you moved them). These missing files can appear as red text or as issues in the Issue Navigator.
This can happen when Xcode is configured to automatically add or remove files to/from source control (under Xcode > Preferences > Source Control). When configured this way, simply creating a project in Xcode causes new project folders and files to be marked for addition to source control. When you later move the project folder or .xcodeproj file these pending adds now point to missing files.
To resolve this issue when Subversion is the source control program, revert the pending adds for the phantom items from your local working copy folder. In my case this requires dropping into a Terminal window, navigating to the parent of the phantom project folder, then reverting the automatic add, e.g.
cd /my-working-copy-folder
svn status --depth infinity
svn status --depth infinity existing-parent-folder/phantom-project-folder/
svn revert --depth infinity existing-parent-folder/phantom-project-folder/
Note that the first svn status command will list both missing files as well as properly added, modified or deleted files which you must take care to avoid reverting. The second status command is "practice" for the final revert command, to ensure you've specified the proper path to revert.
I do not know git but I assume it offers corresponding commands.
It's too simple to do :
Close the project that includes the missed files and open the Xcode, go to "Organizer">"Projects" and remove the project from the list there. Open your project from Finder and that's it.
hope this help.

Resources