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'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'd like to change DSTROOT(or any other variables that Xcode use for build settings) to somewhere else but can't to locate where it's defined.
I'm using Xcode 4.
Looking at the Xcode Build Settings Reference, it looks like $DSTROOT is only affected by $PROJECT_NAME and $SYMROOT is only affected by $SRCROOT, so I'm not sure you can easily change them at all.
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.