The application bundle does not contain a valid identifier - xcode

I try to run my project but i get the following error "The application bundle does not contain a valid identifier."
here my info.plist
I followed other answer on the question. I don't have any "Ressources" folder inside my project.
Thanks for your help

I solve this problem after I delete all build files by Xcode.
Your build file path at Xcode > Preferences > Locations > Derived Data
If you didn't change the default path, Your path is like
I just deleted all files under DerivedData

In my case, this problem occurred when I manually removed a pod from my file browser in XCode.
In order to fix it, I deleted the associated entry in my podfile, and ran 'pod install' from the terminal.
Additionally, I had to delete the relevant search paths and other references to that pod. And of course I had to clean the project.

In my case, my app's bundle contained a dash like com.some-thing.app so I just changed it to com.something.app and the problem was fixed.

In my case, the value for "Bundle Identifier" key was missing in Info.plist

In my case the info.plist had the wrong encoding format, I still don't know why it changed. So I had to create a new one from Xcode and copy paste all the keys.

Cleaning the project solves my issue. Product -> Clean

I was building the wrong target on a device in my case. I was building the Test target rather than the normal app target.

In my case, I've added a framework into Embed Binaries phase, but it was already in my Link Frameworks and Binaries phase, which created a duplicate entry. Once I deleted one of them, this error starting appearing.
To fix it, I've removed the framework from both build phases and added it one more time

For my case, it's caused by a wrong Info.plist in a framework(lack of Bundle identifier and Executable file)
Use ideviceinstaller -i xx.app can see the detailed error log.

I ran into this issue trying to run flutter build ios, where the errors were related to trying to access WatchOS and TvOS simulators. For now, not sure how to disable that.
What worked was to run flutter run

In my case, the framework info.plist lack of Bundle identifier.
use cmake create dynamic framwork misss Bundle identifier of the info.plist

Related

GeneratedInfoPlistDotEnv.h file is not found

I have a issue, regarding Xcode, in react-native permission file
in which GeneratedInfoPlistDotEnv.h file is not found.
How to fix this?
Already changed Info.plist Preprocessor Prefix File to
${CONFIGURATION_BUILD_DIR}/GeneratedInfoPlistDotEnv.h
but it did not solve.
issue is:
:1:10: fatal error:
'/Users/DAMAGE/Library/Developer/Xcode/DerivedData/EmployWise-fzbhiywasjfdjnfqjsfnxjbhahzs/Build/Products/GeneratedInfoPlistDotEnv.h'
file not found
Was getting this from react-native-config cocoapod. But its been fixed in v1.4.11. Was due to the older version not writing output script variables, which XCode 14 requires
This issue comes when react native is not able to link to the configuration file like .env file created in your react native environment. If you have used any react native config framework like react-native-config. then make sure this framework is linked for your iOS environment as shown below
react-native link react-native-config
If you are using react-native version >= 0.60 then follow the below steps after linking is done.
Go to ios folder and run pod install.
Next do the following:
1. Remove Derived Data from Xcode
2. Clean Build Folder
3. Build the project again
I had this problem, my solution was to change the Xcode build system from "Legacy Build System" to "New Build System" in the Workspace Settings under the File menu
In my case, I was trying to add a new target for rn-extensions-share and forgot to add all necessary libraries for that new target.

Xcode 10 Command PhaseScriptExecution failed with a nonzero exit code (EXPANDED_CODE_SIGN_IDENTITY: unbound variable)

This error pops up when doing Project > Test
/Users/.../Project/Pods/Target Support Files/Pods-Target/Pods-TargetTests-frameworks.sh:
line 104: EXPANDED_CODE_SIGN_IDENTITY: unbound variable
Command PhaseScriptExecution failed with a nonzero exit code
How do I resolve "Command PhaseScriptExecution failed with a nonzero exit code" error when trying to test a project with cocoapods?
This helped me
sudo gem install cocoapods --pre
pod update
I've read BugReport. Problem was similar to mine and it was fixed in 1.6.0.beta.1 (2018-08-16) (changelog).
Updated(thanks to Cœur)
1.6.0 (2019-02-07) Was published
sudo gem update cocoapods
This should work now.
I have facing the same issue, i believe this issue have something link to keychain access too (code signing problem), I go to keychain access unlock the login then lock it again fixed this issue. After uploading toOSMojave and Xcode 10 keychain need to reverify the password. (how i find this? while facing same issue and trying all available option, i think to generate certificate again, but while generating private key i found keychain login user name and password is wrong type of message- i lock and unlock again solved my problem). Note this process required your login pass phare.
How to fix:- short tip
Go to keychain access -> right click on login -> lock & unlock again
-> clear Xcode project and make build again.
Some Framework or SDK require Code Signing.
I done code signing and resolved the similar problem for me.
EXPANDED_CODE_SIGN_IDENTITY: unbound variable
Command PhaseScriptExecution failed with a nonzero exit code
I had the same problem after updating BuildSettings and Podfile
I just restarted Xcode and opened a workspace - .xcworkspace (not project - .xcodeproj)
[Workspace vs Project]
Go to pod folder and change the file as executable file. It works for me.
chmod +x filename
filename => your file name like "swiftlint"
On the top of - Pods-yourProjectName-frameworks.sh
export EXPANDED_CODE_SIGN_IDENTITY=""
export EXPANDED_CODE_SIGN_IDENTITY_NAME=""
export EXPANDED_PROVISIONING_PROFILE=""
this is an issue with pod update.
I had the same problem and could solve it, by just renaming the project. In my case this error was, because I had a ' symbol in my project name.
Delete the Pods directory and the Podfile.lock file.
Run pod install to re-create them from scratch.
Clean the Xcode project.
Build the Xcode project.
Well, a simplepod install worked for me :)
I've had the same problem. It turns out that by switching between Xcode9 and Xcode10 sometimes it can happen that the command line tools used for building can be switched so I was trying to build it with 9.4 command line tool instead of 10 which caused the issue.
Going to preferences and setting the command line tool to the right one fixed the issue for me.
Another thing that helped me is to disable and enable iCloud again. (Not sure why.)
Ive been dealing with this issue for a couple of days now. What did it for me was.
-Update cocoapods to the last version
-Update all pods
-Opening keychain access and delete the key made by xcode (with xcode closed)
-Opening Xcode will recreate a new key and will ask you for the password.
-After this I cleaned and built and the application ran on my physical device.
I hope this is helpful since its a very annoying bug.!
Restarting the mac helped me,not the xcode.
Check the issue clearly, if it is related to swiftlint.yml then this hidden file must be present in your directory. If you are working on more than one module then you can copy and paste it from your other modules if any.
If you're on an M1/Apple Silicon Mac, make sure you have your Excluded Architectures set up properly. I don't know why this is necessary, but here's how you do it:
Go to Build Settings
Make sure you view "All" (default is "Basic")
Expand "Excluded Architectures"
Under debug, select Any iOS Simulator SDK, and add a value for "arm64"
Do the above settings for each relevant target, in my case I have "Pods", "Project", and then the iOS target.
nvm alias default 16.6.0 if you want it pegged to that specific version.
You can also do nvm alias default 16.
In My case, I tried many solutions but all in vain
Solution: I just do "Pod deintegrate" and then "pod install" then my project is working perfectly.

Fixing file 'project.pch' has been modified since the precompiled header was built error in Xcode

I was recently working on my application messing around in the info.plist section, and since that my application will not run on my test device:
file 'project.pch' has been modified since the precompiled header was built
Something to note is that the app runs fine in the simulator.
Edit: Now I am getting this error instead of the other one:
No such file or directory (/Users/Me/Library/Developer/Xcode/DerivedData/MyProject-abcdefghijklmnopqrstuvwxyz/Build/Products/Debug-iphoneos/MyApp./MyApp)
How to regenerate the info.plist file?
You could try a deep clean (not the same as Product > Clean) - Option+Command+Shift+K
Note: this means the clean the build folder (by pressing Option + Product -> clean folder)
Close your project or workspace.
In Finder: ⇧shift+⌘cmd+G
Paste: ~/Library/Developer/Xcode/DerivedData/
Delete the ModuleCache folder and empty trash.
Open up your project.
Clean: ⇧shift+⌘cmd+K
Build: ⌘cmd+B
In my case the error message had a small hint:
note: after modifying system headers, please delete the module cache
at
'~/Library/Developer/Xcode/DerivedData/ModuleCache/5CYAJ91AZCB7'
I tried and it worked.
Simply touching the project's pch file solved this issue it for me :
touch Test.pch
Product -> Clean
Product + Option -> Clean Build Folder
Close Project or Workspace
Clean 'ModuleCache' path in Finder.
Worked for me in Xcode6 GM and iOS 8.0.
When the .h file of a Library Provided with Xcode is changed (even a space), this error could occur.
The following maybe tried in order to fix this issue
In, Project -> Build Settings, change Precompile Prefix Header to NO
OR
Run rm -rf ~/Library/Developer/Xcode/DerivedData and Clean Build
I constantly had this since upgrading from Xcode 4.6 to Xcode 5 with iOS projects when using command line build (xcodebuild).
What worked for me is to use this as command line build command:
xcodebuild -project path/to/my.xcodeproj -configuration Debug clean build
Before this, I've tried:
Clean the project in Xcode GUI.
Delete the offending pch file.
Delete the offending pch file's parent folder.
Delete the DerivedData project folder.
None of the above worked for me under Xcode 5.0.2, Mavericks, iOS7.
Note that the problem didn't happen to me when using Xcode GUI.
I just go to directory "/$HOME/Library/Developer/Xcode/DerivedData/", delete everything there
Just Click Product from the menu and select Clean
Product>Clean
Worked fine for me.
I got the same problem. My error said like I need to delete the cache in the below locaition,
Users/myusername/Library/Developer/Xcode/DerivedData/ModuleCache/3FGETKFCU0N0W
3FGETKFCU0N0W was a folder, when I deleted it and then clean build the project. Then the error disappears.
rm -rf ~/Library/Developer/Xcode/DerivedData/
If you use AppCode you can try remove content form:
/Users/[Username]/Library/Caches/appCode30/DerivedData/
Worked for me :)
Also, just open terminal, and delete the .pcm file that has been generated (Xcode 6 onwards)
rm <path-to-pcm-file>
If you get this when switching between git branches, try adding this post-checkout hook which will clean your project every time you change branch.
!/bin/sh
xcodebuild clean -configuration Debug
Save as .git/hooks/post-checkout relative to your project root and don't forget chmod +x .git/hooks/post-checkout
For me, this problem is only occurring in Xcode 6 beta version, So I switch back to Xcode 5, and now problem is solved.
I tried all the steps suggested by all users here, but no one worked for me.
So, if you have both versions of Xcode and have issue only in Xcode 6 beta, then switch to Xcode 5 and clean the project, problem will be solved.
I tried these one by one but failed to build and run my project. So I changed Precompile Prefix Header to NO as mentioned by #Abhilash Gopal, then I reset the simulator,deleted the derived data, removed the corresponding .pcm file(In my case it was the UIImage.h from UIKit framework, so removed the UIKit.pcm).Then I cleaned the project and only then I was able to build it successfully. In earlier versions of Xcode these files were locked basically and were not allowed to edit. But its not the case now. Hope this helps someone who face the same situation.
The only solution there worked for me was running the following command:
sudo rm -R /var/folders/
But that gave me a lot of troubles in OS X.
I thought because /var/folders/ is for temporary files it should be okay to just empty anything in it.
But I was wrong see the following post: link
And the problem you described occurred every-time I tried to build my Xcode project - I'm building it from the CLI though Jenkins.
Which means I couldn't run the rm command every-time. So I found some inspirations and wrote the following ruby script which solved my problem:
#!/usr/bin/env ruby
require 'fileutils'
cache = Dir.glob("/var/folders/**/com.apple.DeveloperTools*")
FileUtils.rm_rf(cache)
I hope it would be helpful to someone.
Deleting project.xcworkspace did a trick for me.
project.xcworkspace is a directory which describes schema of current Xcode workspace state. Each time Xcode is launched it will regenerate project.xcworkspace if not exist already.
In order to delete project.xcworkspace:
Right click on your project file yourProject.xcodeproj
From drop-down menu choose Show Package Content
Purge xcworkspace file
If you are building on command line using xcodebuild remove '-parallelizeTargets' option passed to the command. That fixed the issue for me
After going through a lot of answers and helpful suggestions, I found out the solution to be: Uninstall Xcode 6 and reinstall it through the available dmg file and then install all the components for Xcode.
Product + Option -> Clean Build Folder, Clean Build Project, Deleting Module Cache files and Derived data files, using touch .pch, deleting pcm file, using command line to remove var/folders (Surprisingly, all of this did not help in my case)
Was stuck at it for more than 3 hours before finding the solution. Hope this helps someone.
Thanks.
Just open terminal and fire below command:
rm /Users/pratik/Library/Developer/Xcode/DerivedData/ModuleCache/LKL48GNAN6S7/UIKit-2X95M2Q1NPNPL.pcm
give your file path which return .pcm error. and then Clean Project and Run...Enjoy!!!

xcode library not found

I'm getting the following error:
ld: library not found for -lGoogleAnalytics
clang: error: linker command failed with exit code 1 (use -v to see invokation)
I've spent some time googling but can't find how to fix this problem. I'm new to xcode and this is an existing project that I need to work on.
In my case, the project uses CocoaPods. And some files are missing from my project.
So I install it from CocoaPods: https://cocoapods.org/.
And if the project uses CocoaPods we've to be aware to always open the .xcworkspace folder instead of the .xcodeproj folder in the Xcode.
You need to set the "linker search paths" of the project (for both Debug and Release builds). If this library was in, say, a sibling directory to the project then you can set it like this:
$(PROJECT_DIR)/../GoogleAnalytics/lib
(you want to avoid using an absolute path, instead keep the library directory relative to the project).
All in all, the Xcode cannot find the position of library/header/framework, then you tell Xcode where they are.
set the path that Xcode use to find library/header/framework in Build Settings --> Library/Header/Framework Search Paths.
Say, now it cannot find -lGoogleAnalytics, so you add the directory where -lGoogleAnalytics is to the Library Search Paths.
In my case I had a project with lots of entries in "Build Settings > Other Linker Flags"
I needed to reduce it down to just
$(inherited)
-ObjC
Old settings:
Updated settings:
For me, I open the projectname.xcworkspace file and it all works.
If you have pods installed, make sure to open the workspace folder (white Xcode icon) not the project folder. This resolved the library not found for ... error. Very simple issue but I was stuck on this for a long time.
This worked for me:
Go to build setting -> Linking -> Other Linker Flags -> Remove all other than $(inherited)
Cd ios && pod update
If you are using Pods to include the GoogleAnalytics iOS SDK into your project, it's worth noting that since the 3.0 release your Other Linker Flags needs to include -lGoogleAnalyticsServices not the old -lGoogleAnalytics
If your library file is called libGoogleAnalytics.a you need to put -lGoogleAnalytics so make sure the .a file is named as you'd expect
None of the above worked for me, what did was making sure the Pod file platform :ios, '11.0' matched with the minimum deployment target in the XCODE setting
You can also try to lint with the --use-library option, as cocoapods lint libraries as framework by default since v0.36
The problem might be the following: SVN ignores .a files because of its global config, which means someone didn't commit the libGoogleAnalytics.a to SVN, because it didn't show up in SVN. So now you try to check out the project from SVN which now misses the libGoogleAnalytics.a (since it was ignored and was not committed). Of course the build fails.
You might want to change the global ignore config from SVN to stop ignoring *.a files.
Or just add the one missing libGoogleAnalytics.a file manually to your SVN working copy instead of changing SVNs global ignore config.
Then re-add libGoogleAnalytics.a to your XCode project and commit it to SVN.
In XCode 10.1, I had to set "Library Search Paths" to something like $(PROJECT_DIR)/.../path/to/your/library
For me it was a silly thing: my mac uploaded the file into iCloud, and that is why Xcode did not find it.
If you turn off the automatic upload, it wont happen again.

I'm getting "clang: error: no input files"

I had a file which I deleted and replaced with another file, somewhere else, of the same name.
Despite cleaning, and trying this multiple times, I keep getting this error:
clang: error: no such file or directory: '/Users/Andrew/App/Version 1.1/XCode/UIImage+Alpha.m'
clang: error: no input files
I can't continue working on my app because of it. Any ideas?
The problem might be because your project > target > Build Phases > Compile Sources is trying to compile a file that doesn't exist. It might be in there twice, like the below screen shot. My project contains UIImage+FFXtras, I can even remove it and re-add it and this won't resolve the problem!
I'm not sure how the project gets into this state - but I know it's not obvious what is going wrong. Highlight the red problem one and remove it.
So have a look in compile sources phase for the file clang is complaining about.
Got the similar troubles.
It seems XCode does not generate correct relative filepath when your project refer to an already existing source tree (relative path does not contain the .xcodeproj in the path of the file to be compiled).
There is a simple fix however: in the project explorer select the file or files files then look at the options in the file inspector. One of them is labeled "Location"; set it to absolut path and try again. This fixed the issue for me :)
Additional to all answers:
delete derived data
reboot
delete derived data
clean
build
Success!
Only this sequence works for me in my case.
I use quite a few cocoa pods and have just had this happen to me. A quick "pods update" sorted things out for me. -phil
If you are using vs code and facing this issue which says
clang: error: no such file or directory: 'filename'
clang: error: no input files
Error while running files:
I solved this issue by removing the space or replacing the space with underscore(_) in the filename .extension
In case everything fails (i.e. first try bames53 suggestion)
Ok, this might be dangerous so make a copy of your whole project first:
close Xcode
locate the project file in the Finder
right click, choose "show package contents"
open project.pbxproj in a text editor of your choice, but not Xcode
search for your file
at the beginning of the line that shows up, you'll see some id like 640450991409CF5C00B3B580. Search for this and delete any line you find.
pay attention, not to break the syntax (balance parenthesis and brackets, pay attention for commas)
when you are done, save the file and try to open the project in Xcode. Add the missing file via the Add file… dialog of Xcode. It is still in the folder of your project — if you added it successfully in the first place — you just got rid of all project references.
dont be surprised, if it doesnt work instantly — you have a copy. copy it again, new try.
And remember: make a copy of your whole project first — for every try. or copying the project.pbxproj might be enough.
Add this line in your pod-file and run pod install:
use_frameworks!
I had this error in monodevelop. I just went to edit>preferences
and changed the default location of the program files. It was set to the monodevelop default they give you when you open a file and not the folder i changed it too.
Likely, you need to adjust the settings of xcode, where you stored your files.
I was seeing this while setting up a React Native project. Solved it using:
sudo xcode-select --switch /Applications/Xcode.app
Source
Comment Quoted from another site was the issue is resolved for me
hmm that's strange. Try this - click on the name of your project on the list of files/folders on the left in Xcode (at the very top of the list). Look at the "Targets" section on the left-hand side of the window to the right. Likely, there's two listed with the second being a "test" item. Right-click on that item and select "delete". Then try to run the project again. See screenshot below for a visual cue.

Resources