I want to set the Bundle Version in my plist. However, it appears that the value that is actually LOOKED at by finder to put the version when you look at more info is "bundle versions string, short" Editing this, however, requires opening the plist file, rather than just editing the "version" in the target settings.
Is there a way to either a) make the bundle version always equal the bundle version short, b) make finder look at the bundle version instead of the short string or c) make the short version appear in the edit target settings window?
Or, is there some better way I should be dealing with this?
thanks.
Yes, you can use ${VARIABLE} style macros the Info.plist file.
We make a user-defined setting in the project called APP_VERSION, and then use ${APP_VERSION} in the CFBundleGetInfoString (Get Info string), CFBundleShortVersionString (Bundle versions string, short) and CFBundleVersion (Bundle version) keys. At build time, the variable gets filled in with the correct version.
Watch out though because sometimes a clean build is necessary for Xcode to update the Info.plist file as it does not do dependency checking against the variables.
Related
Since Xcode 13, there is no Info.plist by default. Instead, the common field are in the target’s Info tab, and build settings in the project editor. A separated Info.plist file is added to project only when there are additional fields.
When I run the following command to set MARKETING_VERSION on Jenkins
$ xcrun agvtool new-marketing-version 1.0.0
It doesn't have any effect on Info.plist file unless the key CFBundleShortVersionString exists. But every time I update field in target's Info tab, the Info.plist file seems to be regenerated again and CFBundleShortVersionString disappear.
Therefore, I'm wondering is there any suggestion about how to setting MARKETING_VERSION via command line or how to use agvtool in this case. Any suggestion would be appreciated!
Indeed, in Xcode 13 agvtool has trouble to update marketing version.
In order to "fix" it, set GENERATE_INFOPLIST_FILE to NO in Build settings. This will prevent Xcode to generate the Info.plist automatically. Then create your own Info.plist with the same values and it should works.
Maxime
Goal: To set my target's "Current Project Version" to $(CURRENT_PROJECT_VERSION) so that changing the project's info.plist's Bundle Version variable will automatically carry over to the project file.
How I am doing it: I am using a script to change my project's info.plist's CFBundleVersion using PlistBuddy. Because I want this change to be automatically reflected in the project file, I have set the target's "Current Project Version" to $(CURRENT_PROJECT_VERSION). My understanding is that this is just a pointer to the CFBundleVersion from the project's info.plist.
The problem: Although the script runs correctly (i.e., the Bundle Version variable in the info.plist is updated), the "Current Project Version" never updates, and in fact it displays an empty field instead.
Why is this not working?
Note that I am explicitly trying to do this without using fastlane or agvtool
CURRENT_PROJECT_VERSION is defined in your project.pbxproj file, not Info.plist . To change it, use agvtool:
xcrun agvtool new-marketing-version "your.app.version"
xcrun agvtool new-version -all "your.build.number"
Or you can use fastlane increment_version_number.
The plist is generated from the project file, not the other way around. The plist is (usually) generated every time xcode builds your application, so for most people it is a transient file. If you change your project file's version, then the plist file will stay in sync.
Note that you can use PlistBuddy on an Xcode project file, but since it's a bunch of Guids, you have to query your way through the file to get all of the BuildConfigurations that you need to update.
Or, you can use .xcconfig files which will make it much easier to modify the version which Xcode will read in to modify project settings, and then push that into the .plist.
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
I'm using Bison and Flex in an Xcode project. I didn't want to put the generated files under source control, so I was happy to find that Xcode natively supports Bison/Flex files, generating the parsers on-the-fly in its derived data folder. So far so good.
However, Xcode uses an embedded old Bison version (2.3):
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/yacc
which doesn't yet support the %define api.pure full directive. Since this bison executable is under the Xcode.app bundle I can't replace it, so I installed the latest version via Brew and added it to my $PATH through ~/.bash_profile (~/.bashrc also sources my bash profile). So in bash I can say:
$ which bison
/usr/local/Cellar/bison/3.0.4/bin//bison
However, Xcode still uses it's own version... I suppose the path to the internal bison is hardcoded.
My second approach was to create a custom build rule for Yacc files, and run the correct version of bison from there. This time the problem was that as Xcode ran my custom build rule, it immediately tried to build the resulting C files. The generated C files would however depend on the header file yet to be generated by Flex, because that's where e.g. yyscan_t is declared (used by Bison in the generated C file). But on the other hand, Flex-generated C files also include the Bison-generated header, so compiling with Flex first doesn't help...
What I need is to first only generate the Flex and Bison headers/sources and then build them along with the rest of the project.
How can I achieve this?
I've managed to solve the issue by putting the *.l and *.y files under a *.parser folder and adding that folder to the project. Then I removed the *.l and *.y files added the folder to the compiled sources:
And then made a Build Rule for *.parser like this:
This enables me to first run yacc and lex and only then will the resulting *.cpp files be passed to the compilation step.
If you go to your build target, Build Phases, and click the + on the bar with the search box on it, you can add a New Run Script Phase. You can then drag that above your current Compile Sources phase. You can do whatever you want in that script phase, and it will run before compilation starts.
This is a bit of a Zombie, but if I ever come back here again, I will want to see the answer.
Certainly from XCode 12 (probably before) the answer is trivially easy.
(1) Go to build settings
(2a) Press the + for a brand new setting variable.
(2b) Change the NAME to YACC, and it's VALUE to /usr/local/bin/bison (or whatever path you need for brew).
(3a) Press the + for a brand new setting variable.
(3b) Change the NAME to LEX, and it's VALUE to /usr/local/bin/flex (or whatever path you need for brew).
(4+) use the YACC/LEX settings for flags that you want to use.
I've managed to do it with custom build rules, using bison installed from brew and flex that comes with macOS, not the one bundled with Xcode. I'm not sure if my problem was the same as yours, but if you want to take a look my project is on GitHub.
I'm very new to cmake and I'm trying to build os x application using it, the problem I've faced is that I need to specify NSPrincipalClass inside Info.plist to be able to launch it. (otherwise I'm getting "No Info.plist file in application bundle or no NSPrincipalClass in the Info.plist file" error). The problem is that there is no way to do it using cmake MACOSX_BUNDLE_xxx variables.
I probably can use some workarounds like script that will add it after building or something like this but is there a better way? I might also modify default plist template but than is there a way to include it inside project repo so there will be no need to modify it on every machine or after reinstalling cmake etc?
I've solved this issue. I've created my own template (file name is MacOSXBundleInfo.plist.in) put it into cmake/modules/ folder inside project root, from there the only think left is to add
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")
into your CMakeLists.txt