Xcode file not found - ios

I am facing an error of file not found.
I have added all necessary files, but it gives file not found for a file.
#import "MagickWand.h"
for above file it gives error.
#import "FrameSection.h"
#import "FreeCropIphone5.h"
#import "DoodleView.h"
Please help me.

Clean the build folder by pressing ⌘ + ⇧ + k. It may help you to rectify the error caused.
There can be many cases that cause this error. This is one of the option to clear that error.

NOTE
As According to this kind of problem the reason may be sometime due to cyclic import. means like you have a file with the name first.h and you importing second.h and in second.h you importing first.h and you not including first.h.
Try these steps hope this will help you.
target of project -> Build Phases -> Compile Sources ->
delete the [found filename that cause the error in program].m
Add it back again in you project.
Clean Your iOS project And then Build Again.

I dragged folder in XCode, it started appearing blue and files in that folder wasn't accessible in Project anywhere although they does exists in blue folder.
Solution:
I simply deleted that folder reference from project, created "New Group" and added files in it, its started working correctly.

I was facing this error after a merge from the repository (git). The final solution was:
Delete the files from the xcode project navigator (only deleting references).
Add them again to the project (dragging from finder into the project navigator).
Hope it helps!

Check that your corresponding frameworks are included in your bundle.
For that, access to your project settings, select your target, and under Build Phases, check on the "Link binaries with libraries" section that your frameworks are here.

Use the search bar in the Target -> Build Phases window to make sure the missing file's .m is listed under the Compile Sources and the .h file is listed under the Copy Files. If it's not there, add it.
I was able to fix this problem by adding the missing .h file.

Related

Could not find a valid GoogleService-Info.plist in your project

When I run my swift 3.2 code with Xcode 9 beta 4 this is the error I get:
*** Terminating app due to uncaught exception 'com.firebase.core', reason: '[FIRApp configure]; (FirebaseApp.configure() in Swift) could not find a valid GoogleService-Info.plist in your project. Please download one from https://console.firebase.google.com/.'
I already have a GoogleService-Info.plist file that is named exactly like it should and it is valid.
Is there any trial to firebase or something like that?
Remove the Google-Info.plist file from your project and try to add it from your project folder's option menu.
EDIT:
this is how you remove a plist file
Xcode 10 Error: Multiple commands produce
I had the same issue.
Click on the Googleservice-info.plist in your project and check Target Membership for app in the inspector. That fixed it for me.
That is the reason for this crash and removing the file and adding again is another way of doing as suggested by answers above. But the actual cause is this and this is the right way to solve it.
Please refer to the image below for further clarification:
Once you add the file to the project, you may also need to add it to Build Phases in the Compile Sources section.
Add the GoogleService-Info.plist in Build Phases as screenshot above:
Make sure the name of the file is correct, i.e: "GoogleService-info.plist"
Add it to the project in mac finder under the project name and then drag it into the project to reference it.
Finally, as Silvajee mentioned, go to the file inspector for the plist file and tick the box under target membership to include it as part of the project.
If you have multiple environments (Production, Develop, Staging), you will need a different Google.plist for each.
They all have to have the same name.
To get around this, create folders for each of these files (one for each environment) and place them inside their corresponding folders.
When you drag the files from the Finder to Xcode, make sure to select the proper environment for each under Target Membership
That will do the trick and allow you to build environments separately. Especially if each environment has a different Bundle ID.
Make sure your file name is correct as "GoogleService-Info.plist". Any other name would cause problem. Restart XCode and you are good to go.
Unfortunately or fortunately, the error specified is very accurate. There is only one option available right now. i.,e placing Google-Info.plist file in your project properly. Try to remove and add that again. Also, check if a target is selected or not.
Restarting Xcode worked for me, none of the above option worked.
These steps solved my problem. FOllow these.
1.You must drag and drop the GoogleService-Info.plist file into your project in a location such as Shared Resources. When you have successfully added the file, you should also make sure to include it in the project build:
2.Double-check that in the "Build Phases" section of your project that your project is including GoogleService-Info.plist.
3.Double check the file name. The file name must be exactly GoogleService-Info.plist common misspellings include GoogleServices-Info.plist and GoogleService-info.plist - case sensitive and exactly named only will work.
Actually this error is occur when GoogleService-Info.plist file is not actually located in our project folder but it just have a reference to that file where it is downloaded. So solution is that remove reference to this file and again add it to your project folder by drag and drop or by using "Add Files ..." option by right click to your project folder. Also recheck whether file is locating your project folder destination otherwise error will be occur again.
Don't forget to check your "GoogleService-Info.plist" file have same name as shown in error otherwise rename it.
For those of you working with Ionic, make sure to open your .xcworkspace file in Xcode first, then drag the GoogleService-info.plist file into the Resources folder.
Most tutorials online don't do a good job of explaining that portion for some reason.
Shout out to Shahzaib Maqbool because his comment helped me get this for my project.
Below setting can fix my compiler fail
1. Add to "Copy Files"
2. Not add to "Copy Bundle Resources"
We must make sure that full path is correct in Xcode. It would be better to add it from the start. If you already did, jump to step 5.
Quit Xcode.
Make sure that file name is correct, "GoogleService-Info.plist".
Add .plist file to project folder. Same level with Podfile, .xcworkspace, etc.
Open Xcode, identify .plist file on Project Navigator. If it's not there, right-click and click Add new file to "[Project Name]". Make sure to click project name below Add to targets option.
On Project Navigator, click on GoogleService-Info.plist. Select File Inspector from right navigator. Ensure that Full Path is correct. If not, click on folder icon and select the .plist file inside the project file.
Build. If still doesn't work, Quit Xcode and Build again.
Doing a clean then build a couple times worked for me.
1 - open "GoogleService-Info.plist" and change any or to and
2 - reopen the xamarin solution
3 - it should work now
I solved the issue by deleting the project from Firebase and deleted the GoogleService-Info.plist from project. After I again added the project to Firebase and added the new GoogleService-Info.plist file worked for me.
This error occur download google service more than 1 time. When we download first time from firebase, it's like GoolgeService-Info.Plist. If you download again, that will come GoogleService-Info(1).Plist. We need to remove (1) from GoogleService-Info(1).Plist.
Please try this.
Click on GoogleService-Info.
checked the target membership on the right side .
Clean and build . It will work.
2022 Update
If you're migrating from older firebase version and want to initialize Firebase from Dart only, then you have to remove Firebase Initialization from AppDelegate.m or Appdelegate.swift
in swift, remove FirebaseApp.configure()
and start again.
I know this question has a million answers already, but perhaps this solution will help someone who isn't using Xcode build configs like many answers above.
If you're converting an iOS app to Catalyst (as I am), then I found a minor but obtuse difference is Catalyst apps make bundles with a "Content/Resources" folder structure that was throwing off my builds for a while. My build phases copy my release/debug Plist files for me and the pathing difference from iOS -> Catalyst was causing this error.
You can probably solve this problem many ways, like the multiple folders with same named Plist files above. I use a custom bash script via build phases, and copy the file manually like this:
if [ $CONFIGURATION == "Debug" ]; then
echo using DEBUG firebase!
# Mac Catalyst appends a "Contents" folder so we need to handle that explicitly here
if [ $IS_MACCATALYST ]; then
#echo "MAC CATALYST BUILD"
cp ${SRCROOT}/${PROJECT-DIR}/your-custom-paths-here/GoogleService-Info.plist ${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.app/Contents/Resources/GoogleService-Info.plist
else
cp ${SRCROOT}/${PROJECT-DIR}/firebase/debug/GoogleService-Info.plist ${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.app
fi
fi
Go to build phases and add file in copy bundle resources. Thats it.
delete any other "GoogleService-Info.plist" files that have been previously installed. in my case, when I installed it, it was names as "GoogleService-Info.plist-2" since I had another file installed in the same folder. it looks that this will create a confusion for firebase. I deleted all old files and changed the name of the current one to "GoogleService-Info.plist" exactly. it worked.
In my case something went wrong when i merged conflicts in project.pbxproj
GoogleService-Info.plist -> didn't have Target membership selected on the right pane and I couldn't select it because project.pbxproj was corrupted (even though build was successful)
I had to rollback project.pbxproj and after that GoogleService-Info.plist had Target membership selected.
Make sure project.pbxproj isn't corrupted after merging conflicts (it had something to do with attempted to initialize an object with an unknown UUID)
For anyone using Xamarin by mistake (you should avoid this piece of tool by all means):
open project file as code, and check that the file has import tag BundleResource, and not None (the red one is the correct one):
I'm using FirebaseUI and was receiving a slightly different error when pressing Sign-In with Google:
***Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'OAuth client ID not found. Please make sure Google Sign-In is enabled in the Firebase console. You may have to download a new GoogleService-Info.plist file after enabling Google Sign-In.'
What fixed that issue for me was changing this line (that seems to be deprecated)
[[FUIGoogleAuth alloc] init]]
to
[[FUIGoogleAuth alloc] initWithAuthUI:[FUIAuth defaultAuthUI]]
when building providers list
NSArray<id<FUIAuthProvider>> *providers = #[
[[FUIGoogleAuth alloc] initWithAuthUI:[FUIAuth defaultAuthUI]],
[[FUIPhoneAuth alloc] initWithAuthUI:[FUIAuth defaultAuthUI]]
];
Another easily overlooked problem is when you have multiple PLIST files downloaded so the file is not exactly named 'GoogleService-Info.plist'.
I had multiple copies so was trying to use 'GoogleService-Info.plist(2)' which throws the same error, so make sure the file itself is named as it is meant to be!
My problem same this case and solved that ->
ı added xcode runner Open Xcode, then right-click on Runner directory and select Add Files to "Runner".
most importantly;
terminal: cd ios- " pod install "
and info.list thats ok.
ı hope your problems solved
I had to same issue and same error what you have. I downloaded from Firebase more than one info.plist file that why my MacBook save these files like
GoogleService-Info.plist,GoogleService-Info-2.plist,GoogleService-Info-3.plist
Then I copied mistakenly in my project GoogleService-Info-3.plist then I took same error. Then I just copied GoogleService-Info.plist and problem has been solved.
But be careful about bundle identifier. You have to copied correct project plist.
Just drag and drop the file into terminal, don't copy paste from Notes or TextEdit or from elsewhere.

Xcode 8.0 Command /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc failed with exit code 1

When I compile my code on Xcode Version 8.0 beta 4 (8S188o) I get this single error bringing the compilation to failure:
Command
/Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc
failed with exit code 1
I tried to clean the project and wipe the derived folder but that did not change things.
What is it and how may I know more about it?
When I try to compile on the terminal the error being reported is:
Invalid bitcast\n %.asUnsubstituted = bitcast %swift.error* %13 to
i2, !dbg !438\nLLVM ERROR: Broken function found, compilation
aborted!\n
Happened to me, when I had two classes with the same name in my project. After deleting the redundant one, error disappeared.
If you look above the error, Xcode will tell you which ViewController is added/declared twice, navigate to it and remove the reference. Build and you're good to go.
I am going to tell you my silly mistake, the error is showing the issue and It took 3 hours to me to understand. look into below error
look into above 2 lines of error, the problem is shown, Obviously, In my case Xcode is complaining that Location.swift and Customer.swift file is missing, look into my project hierarchy, the same issue can understand.
It's my advice to everyone that first understand the error and then look into issues. I removed my desktop files, which were referenced in the project, and therefore compile error occurred.
Clean your project that fixed my project
Product/clean
I got this error for core data models that i've created manually.And it got resolved by changing particular entity's 'Codegen' attribute to 'Manual/None' under Data Model Inspector.
If you change any file folder location or change any Objective-C Bridging file path. Then it's happened some time.
Update your Bridging path.
Clean your project alt + Shift + Command + K
Quit Xcode completely Command + Q
Open project again and wait for Xcode to index files.
I got this error when I was trying to run an xcode project. A swift file wasn't being found and complied correctly, even though clearly in the xcode project file you can see the swift file and when you click on it in finder the file comes up as a separate xcode swift file. I solved this by:
Deleting the problematic swift file
Creating a new swift file with the same name
Xcode prompts that the file is already created, press replace
copy/replace the code/etc. in the file
Clean the project (for good measure)
Run the project
The problem went away by itself for mysterious reasons. Instead of the whimsical linking error I got a new bunch of errors due to Swift 3 fling which the app compiles and run fine.
The solution that worked for me is I had to delete the .xcdatamodeld file in my project and create a new one. This solved it.
I got this error and resolved by changing Xcode command line tools,
Goto Xcode -> Preferences -> Choose Locations tab
Choose required Command Line Tools from drop down, run the project error has been fixed.
In my case the error triggered when Xcode could not find a file/folder from the external Framework and dependency. In such a case just pod update / pod install do the job.
Try removing inactive file(deleted file) from Build phases...
Based on #Mohammed Rizwan N answer
If error not gone, do the clean project and close Xcode. Then click right button on .xcodeproj/.xcworkspace file and choose appropriate Xcode version.
In my case, I tried to run a project in Xcode9/Swift4, while the project was written on Xcode8/Swift3
1.Go to build settings and check the path of the info.plist file and bridging header file.
2.If not sure they are correct , from the left side drag and drop the files into respective fields .This creates the path automatically .
Clean the project and build again .
I created 3 new groups and put my MainVC under one of those groups. After I deleted one of the new groups I created, the error went away after I cleaned my project.
Please update your entire log which suggests the error, mine is telling me I have duplicated classes in file
Try closing Xcode, cleaning the project and building again.
At first, cleaning wasn't enough. I had to actually close it and try again.
I faced this issue when I resolved git conflict for the project file, which was for adding and removing some files.
What I found out is Xcode creates the folder named folder named "Recovered References", just search this from bottom left search option from Xcode and delete it. After you delete it you will only get an error for missing files. Resolve that by adding files again by right-clicking and selecting add files option. Once you are done with it project compiles with no error.
Happened to me when I found two swift files with the same name within the project, even if the classes have different names.
In my case error came when I moved my bridging-Header.h file from one folder to another. and when I checked in Build Settings -> Objective-C Bridging Header it was showing old path. Then I moved that file back to previous folder.
My problem was that my machine was running out of available space. Restarting it cleaned up ~8GB of temporary files, but I guess you can also delete something instead.
This is mainly because xcode is not getting the exact path of any file or duplication of file name under linking area.
In my case I have added bridge header file under Resources file and added the path in
BuildSettings->Objective-C bridge header-> bridgehearfilename.h
You should specify the exact path of that file in this section.
eg: BuildSettings->Objective-C bridge header-> Projectfolder/Resources/bridgehearfilename.h
Correct your file paths in the build settings then Clean and build the project.
For me it was ,
Product > alt + Clean Build Folder
OR
alt + Shift + Command + K
Do these 3 steps:
Clean Project: Shift+Command+K
Make sure low disk space shouldn't be on your mac
Focus on the upper lines of this error...Try reading them again...Paste those files that are missing or having some light icon in xcode project navigator and delete those files with light icon.
Hope you will fix the error.
I tried to run a project in Xcode12/Swift4, while the project was written on Xcode8/Swift3
so I install Xcode version 11.7 and run this work for me.

Failed to remove "Info.plist" couldn't be removed

I have been trying to fix this a few days before. I was adding JSQMessagesViewController to my iOS project. Added the library manually by dragging and dropping the JSQMessagesViewController folder downloaded from Github. tried to add a Bridging header for jsqmessagesviewcontroller. tried to add
#import JSQMessagesViewController
#import JSQMessages.h
later then when I build the project I found this error message
error: failed to remove /Users/user/Library/Developer/Xcode/DerivedData/CHATAPP-gcvyuyhkvbxvnlfnrrbmaebxevhx/Build/Products/Debug-iphonesimulator/CHATAPP.app/Info.plist: “Info.plist” couldn’t be removed.
I tried searching but didn't help any... what went wrong? How Can I remove this error ? using swift 2.2 and xcode 7.2
I began experiencing this issue right after making a pod install with Fabric (that made some changes to Info.plist). Then I realized that there was two Info.plist references in my project.
To solve the problem I just removed one of them, cleaned my project (Cmd + Shift + K) and built it again.
Hope this helps.
I fixed the similar issue by removing info.plist from BuildPhases-> Copy bundle resources -> "info.plist"
remove error specific .plist file from "Copy bundle resources" (in my case info.plist in MGSwipeTableCell creating issue)
you may need to add the files to your project. While in XCode right click on your files and select "add files to project" navigate to your project folder and select JSQMessagesViewController files then build.
You may also want to clean your derived data if you press Command Option Shift K then build the project again.
Removed those manually added files from my Project then made a fresh install using Pod now I don't have that error.
i recommend to you use pod to your project or drag and drop only require files from JSQMessagesViewController
you should don't import another project completely.
conclusion :
use pod for using JSQMessagesViewController because it has some dependency

Xcode .pch error while compiling. clang file not found

I have a very annoying problem.
I backed up my code on Dropbox but now i get this error while compiling
clang: error: no such file or directory: '../firstFoo-Prefix.pch'
Since the only .pch file in my project in Xcode and my project folder is secondFoo-Prefix.pch and I don't know how to fix this error I've decided to remove every .pch file so i went into Project> Build Settings and removed everything in the Prefix Header and set Precompile Prefix Header to NO.
Before this the Prefix Header had value secondFoo-Prefix.pch and not firstFoo-Prefix.pch.
Even though the compiler should not look for .pch files I still get that error.
I've looked everywhere in my project but I can't seem to find anywhere firstFoo-Prefix.pch.
Any ideas?
Thank you
This can occur (not your fault) when the Xcode project file database gets messed up such that the referenced file does not appear in the navigation area but is still somehow included in one of the various list of files used for the build phases.
To see if this is the case:
In the Finder, right click on the project file and select 'Show Package Contents'
Right click on the file 'project.pbxproj' and 'Open With->TextEdit.app'
In TextEdit menu: 'Edit->Find->Find...' [or command-F] then enter '.pch'
Look at all occurrences of '.pch' [command -G to move to next one]
If you find occurrences of '../firstFoo-Prefix.pch' then your project file is corrupted. Looking at the context of the occurrence(s) will give you some indication of which area the corruption occurs in (e.g. build phase compile files list).
Sometimes just deleting those references (after having backed-up the project file of course) has worked for us but other times it just makes matters worse. The safest recovery is to create a new project file and copy over all the folder groups and settings manually. Your source code is all fine, it's just the cross-references and build settings that need reworking.
Do a clean for build using this combination: Shift+Option+Command+K
In my case, I have Framework which need to add to main project from derived data after it building successful. So copy items if needed was not tick marked and that's why giving error and also #ZAZ and #chiwangc mentioned cleaned it before building.

library linked but Xcode says "file not found."

This just started happening with my project and I have no idea what to do.
I've been using the Parse framework and everything has been fine so far. But now, even though the library is included:
and linked:
I still get a "'Parse/Parse.h' file not found" error when I import it into classes. Even weirder (at least to me), the project still builds and runs. When I build or clean the project, the warning disappears, but then it reappears right away.
Any idea how I can fix this?
For all who have not found issue:
Go to Build settings and search for "Framework Search Paths", then remove everything and put ./ and make it recursive (by double-clicking on it)
IMPORTANT - Don't download Parse framework on Windows and then copy to Mac! inside framework there are some links and while copying they get corrupted. Download the framework directly from Mac and when added to xcode make sure it has "Headers" folder under it in XCode frameworks.
I hope it helps some people.
have you tried by changing the #import "Parse/Parse.h" to #import ?
The compiler will search for the header files in a special search path. In your case, it seems that the file "Parse/Parse.h" is not in your compiler's header file search path. Check this in your compiler settings.
How many targets do you have? If more than one, maybe the debug target doesn't include the framework.
I have the same problem when I use the demo called "TodoTable", and I solve this by deleting the link in target -> Build Phases -> Link Binary With Libraries -> Parse.framework, and then, adding it again. You may do it by clicking + button, and choosing Add other..., then, in the project folder, you can find the Parse.framework file. After that, rebuilding your project, and it will be ok.

Resources