Name Change Issue - Xcode trying to build from old file name - ios

I've changed the name of my project from "BSV22" to "BSVC". I renamed the project by going to project navigator and double-clicking the title. I accepted changes to all the file names. When I then run the project I get the following error:
could not read data from '/Users/bobpreston/Desktop/BSV22/BSV22/BSV22-Info.plist':
The file “BSV22-Info.plist” couldn’t be opened because there is no such file.
it's pretty obvious why Xcode can't find the old file "BSV22-Info.plist"...because it was renamed when Xcode changed all the file names during the project rename. my question is why is Xcode still trying to build from that old file? it should be compiling from the new filename "BSVC-Info.plist" - and also how do i fix the issue? what else do i have to do?

In your target Build Settings, check the Packaging section for the row called Info.plist File. Make sure it has been updated to use the new filename.

While renaming the project name from old name below are the steps:-
1) Changing the name from testing to testing123 and enter.
2) After that it will show the below window. So just click on the rename button
3) After that clean your build and run.

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.

Could not determine generated file paths for CoreData code generation

While building my project for different target I am getting this error:
Could not determine generated file paths for Core Data code
generation:
Error Domain=NSCocoaErrorDomain Code=260 "No current version for model
at path
/Users/abc/Documents/Code/xyz-ios/ABC/iPhoneXMPP/SRT/Model.xcdatamodeld:"
UserInfo={NSFilePath=/Users/abc/Documents/Code/xyz-ios/ABC/iPhoneXMPP/SRT/Model.xcdatamodeld,
NSLocalizedDescription=No current version for model at path
/Users/abc/Documents/Code/xyz-ios/ABC/iPhoneXMPP/SRT/Model.xcdatamodeld:}
Path mentioned in error is "
/Users/abc/Documents/Code/xyz-ios/ABC/iPhoneXMPP/SRT/Model.xcdatamodeld
" but "SRT" folder is inside "Temp" folder in my folder structure.
How can I resolve this issue?
Similar to shallowThought's answer, I found I had to first uncheck the target, and then re-check it, and then re-build.
In Xcode, select your Model.xcdatamodeld model and tick the checkbox "Target Membership" for your new target in the Inspector.
In My Case it was a result of Model.xcdatamodeld having conflicts when Merged with Remote (Source or Head). Somehow this conflict wasn't detected by GIT and slid through as Conflict Free.
Resolution: Open Model.xcdatamodeld as xml (with textEditor) and search for conflicts (>>>). Fix conflict and Save.
In my case, I had renamed the directory in which my .xcdatamodel resided, which resulted in the old filename entry not being removed from my Target's Compile Sources phase.
All I had to do was remove the old file from the Compile Sources phase, by searching for xcdatamodeld and removing the relevant (now irrelevant...) entry in my target's Build Phases tab:
Don't forget to do this for ALL the targets that contain your Core Data data model.
Once you're done, make sure that your actual current .xcdatamodeld file is added to your target. You do this:
a) By clicking on the file in Xcode's Project Navigator (left column -> first icon):
b) And then ticking the boxes of all targets that you want this file to be a part of, in Xcode's File Inspector (right column -> first icon), under Target Membership:
In my case in File Selector Code Generation was Selected as Swift.
As I selected Code generation language as Objective-C.
Error Disappeared.
After selecting Objective-C
Product > Clean
and then Rebuild the project.
This worked for me.
Just Clean and Build worked for me after adding Core Data manually (not from the start of the project).
The answers given above are just right, but if these do not work, then:
Make a copy of your model and store it somewhere
Delete the model from Xcode
Add the model again to whatever folder you want to add it to
This solved my issue. Hope this helps.
If you are using NSPersistentContainer, it is available from iOS 10+.
You need to change the Target > General > Deployment Info > Deployment Target to 10.0+.
Then, Product > Clean & Build. It worked.
Module Inspector > Module > Current Product Module
Clean and Build afterwards.
In my case I tried to build form an external drive.
Copy the project to the internal drive, and it will work.
In my case, I was saving a new version of .xdatamodelid in the pod project .xcworkspace instead of the original xcproject. Saving it in the original fix my problems.

Getting error after changing project folder name in XCode

When I created my project, I called it "Project1". Then, later I've changed it to "Project2" from the Xcode. I changed all "Project1" to "Project2", but now, when I compile my project, it looks for files in Project2/Project1/myFile.swift and I get the next error:
<unknown>:0: error: no such file or directory: '/Users/myusername/Copy/Projects/Project2/Project1/myFile.swift'
I need to make that it will look at
/Users/myusername/Copy/Projects/Project2/myFile.swift
without Project1 in the path.
How can I solve this problem? Also, I changed from Xcode Identity and Type section Location of my project.
Today I had the same problem when I renamed the folder containing the Xcode project and some parent folders of it.
In my case there where a .swift file shown with it's name in red in the list of files of Xcode (Navigator area). I think that this means that Xcode was not capable to find that file.
I selected that file (actually it's not a real file but a representation of it).
Then, in the File Inspector (Utility area), I clicked on the Folder icon and chose the file on Finder.
This worked for me.
Renaming projects in xcode in one of the most annoying things in iOS development. I assume you want to rename your app. I faced this problem once and figured out a simple, clean way to do it.
Go back to the point where everything worked.
Open project in xcode and click on the project icon in the project structure( first file)
Go to the info tab
Search for Bundle Name. Most probably it will automatically be set to $(PRODUCT_NAME) which is a shell variable that will set your app name the same as the project name.
Set it to whatever you want your app name to be
Done
Note : If you use custom URL Schemes this might produce an error when redirecting.
ALWAYS use git or some other SVN in your projects. This will come in handy in this kind of situations
Change you folder name in you finder "Project1" to "Project2"
Remove "myFile.swift" file from project (copy on Desktop)
Restart Xcode. Copy "myFile.swift" in project select "Copy file to folder" hope this will help.

Error after renaming Xcode 6 project: "linker command failed with exit code 1 (use -v to see invocation)"

So after I create an Xcode 6 project, even if I haven't written any code in it, if I try renaming it by double clicking the bolded program title in the upper left hand corner of the navigator and then confirming that I want the checked items' names changed, I get the following error when I try running it: "clang: error: linker command failed with exit code 1 (use -v to see invocation)"
I've even tried using the find tool to see all the things named the previous name, including the info.plist (which I think is the problem) and changing them to the new name. By renaming the info.plist manually I get an error saying that doesn't exist.
What am I doing wrong?
I saw the same error after changing the name, and I was able to fix it by clearing the "Test Host" values in the Build Settings of my "Tests" target:
Alternatively, If you need your tests to be able to run after changing the name of your project, you should be able to update the MyProject.app/MyProject value in both fields to reflect the new name of your project (ie. MyNewProject.app/MyNewProject)
If above method(s) doesn't work and if for now you don't feel like needing to test anything in your project, just remove your project test target.
Later on if you need to create some tests, you will still be able to add test targets again.
Go to the Build Settings of my "Tests" target then change the paths from the old project name to your new project name
Test Host
- Debug Build/Debug-iphoneos/OldProjectName.app/OldProjectName
- Release Build/Release-iphoneos/OldProjectName.app/OldProjectName
Test Host
- Debug Build/Debug-iphoneos/NewProjectName.app/NewProjectName
- Release Build/Release-iphoneos/NewProjectName.app/NewProjectName
Just simply clearing them would break your tests so you need to replace them with the new project name.
Ran into this too, after copying and renaming the folder with an xcode project. I think it's a bug in xcode. Best file a bug with bugreporter (https://bugreport.apple.com/). Removing the test target from my project fixed it for me, too.
Here is what I've done to fix the similar problem since I changed the project name and folders under the project.
Select project file : projectName.xcodeproj
Right click on the project file and click "Show package contents" to open project.pbxproj file.
Once ope project.pbxproj file, replace all from old project name (whatever you changed from) to new name.
You can change the name of sub folder if you changed folder name too.
Hope this help.
There are different places where you should check for the rename.
You should check for the "old" project name in the test target and in the project target. Search for the old name string and rename them manually to the new name.
If you doesn't use the test target you can delete this target.
There are many places you have to check upon re-naming. This approach does not seem at all practical.
If you really need to do this, I recommend creating a new project and just copying the necessary files over to the new project.

How to change workspace name in Xcode?

Is there any appropriate way to change workspace name in Xcode?
Seems to me that it works to quit Xcode and manually change the .xcworkspace file from OLD_NAME.xcworkspace to NEW_NAME.xcworkspace.
Xcode 5 was used at the time of writing.
2019:
First note that this question is about changing the name of an Xcode workspace. The QA is not about changing the name of a project, a project within a workspace, the source folder, or other aspects of naming in the Xcode milieu.
Xcode 11 and further.
Surprisingly, you can now just change the name of the file ! As strange as that seems.
Quit Xcode. You must do this first.
Using your mouse, and keyboard, change the name:
This causes no problem with Swift Package Manager or any other issue.
You now simply open the .xcworkspace file as normal.
One part of a fifteen year old Apple problem resolved!
Steps to Rename Workspace
Rename the Folder( contain all files) of Main Project
Rename the Workspace
delete the Xcode project from Workspace and re-add/Drag Xcode project again to Workspace. And in build setting rename “product name”
Now, In Workspace ,select the project in general , option for selecting infoPlist will appear, select the info plist of project.
then, Click the Manage Scheme and Create New Scheme with Xcode Project Name , check the New Created Scheme and delete the older one.
clear the both Xcode and Workspace ..and delete Derived Data “~/Library/Developer/Xcode”
if project contain Bridging Header file then , just rename the Bridging Header file with With project name - “ProjectName-Bridging-Header.h” and then open the Xcode project not workspace. In build settings.. in “Swift Compiler -Code Generation”—> Objective-C Bridging Header — “reset the Path of Bridging header file”. close the Xocde. And if Project Contain Pod File , then open Pod file rename the target name with new project .close both xocde project and Workspace project and install the pod.
now open the Workspace clean and build.
Yeah I reckon so. As far as I can see, a workspace is just a reference to one or more Xcode projects and doesn't produce anything outside of those projects.
I tried the same (XC6) but got a build error with one file not found. Not a huge issue, but for some it might not be worth the effort.
In my case I had to rename also the project inside the workspace which had the same name.
For that it was important before renaming the project to..
close Xcode
rename the .xcworkspace-file from the Finder
open Xcode with new named workspace
rename the project inside the
workspace with Xcode help by clicking on the project name
I want to change the workspace name, project name and all linked file with old project name, so I tried the steps from this post, and it's really helpful
Renaming an Xcode project with Pods: the easy way
https://medium.com/programming-lite/renaming-an-xcode-9-project-with-pods-the-easy-way-5d1228ef25a

Resources