Is WorkspaceSettings.xcsettings file required to be uploaded to git? - xcode

I am developing an iOS app and I was committing my works using bitbucket. During committing, I found a file named "WorkspaceSettings.xcsettings". And the has the following contents in it:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>PreviewsEnabled</key>
<false/>
</dict>
</plist>
What is the use of this file and is it required to be uploaded to my repository?

If this file is located in
<Project>.xcworkspace/xcuserdata/<user>.xcuserdata/
in particular within a folder xcuserdata, then it's user specific.
Anything within a folder named xcuserdata is considered by Xcode to be user specific which you usally won't want to be stored in the git repo.
Your .gitignore file should contain a line
xcuserdata/
which ensures, that no user specifc data will be part of the repo.

Related

How to build MacOS app with hardened runtime in AppBundler

I am using AppBundler plugin in gradle to build my Java app.
Now to have my app notarized, Apple requires the app to be built with 'hardened runtime' option.
Does anyone know how to achieve this?
I added the following entitlements when signing my app and fixed the problem.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.security.cs.allow-jit</key>
<true/>
<key>com.apple.security.cs.allow-unsigned-executable-memory</key>
<true/>
</dict>
</plist>

How to add version and copyright info to a file in MacOs

I am building an executable in GoLang for MacOs.
I need to add version and copyright information to the built file.
How do I do this during the go build process or afterwards?
For example the iBooks application has this information
P.S.
I usually build for Windows only where I use Versioninfo format to add file properties but cannot find something equivalent for MacOs
iBooks is an application bundle, not a single binary like you would build with go. So you would need to find a way of wrapping the go binary in an app bundle in order to get this detail, and if it was applicable to your executable.
If you right click on the iBooks icon and then select "Show Package Contents", then navigate into the Contents folder you will find (among other files+folders) an Info.plist file and a version.plist file which hold the definition of the copyright and version respectively.
Info.plist
...
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2013–2018 Apple Inc. All rights reserved.</string>
...
version.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>BuildAliasOf</key>
<string>iBooks</string>
<key>BuildVersion</key>
<string>1</string>
<key>CFBundleShortVersionString</key>
<string>1.14</string>
<key>CFBundleVersion</key>
<string>1458.15</string>
<key>ProjectName</key>
<string>iBooks</string>
<key>SourceVersion</key>
<string>1458015000000000</string>
</dict>
</plist>

MacOS app bundle compiled from qt, icon on and off

I have been annoyed by this problem for a long time.
Firstly I compiled an executable by qt-5.8.0 in qt-creator.
Then I manually built .app directory MyApp.app, by the operations introduced on the Internet, I successfully built an app without any icon.
Then I built the .icns file and put it under Resources directory and manually set up Info.plist file under the Contents directory, Info.plist file is as follows:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleIconFile</key>
<string>icon.icns</string>
</dict>
And then when I put the .app file into some directories, it displays the icon properly, but when I move it to other certain directories it fails, say ~/Desktop.
I am really confused by the problem, and I haven't use Xcode during the whole process.
Thanks for any advice!

Extracting entitlements from Xcode capabilities

I need to obtain an entitlement file generated by Xcode automatically when you're building a project.
Normally (even when you don't have any explicit capabilities selected), you can find one at $DERIVED_FILES_DIR/$PRODUCT_NAME.xcent, it contains generic information about your team and keychain access.
Does anyone know a way to generate it bypassing the build phase.
I want to figure out a flow that is unrelated to the fact whether explicit entitlement file was specified or when Capabilities pane was used to specify them.
Perhaps I'm missing something obvious, any information would be greatly appreciated.
I actually found a way (thanks to Apple's engineers):
$ codesign -d --entitlements - /path/to/app/bundle.app:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.security.app-sandbox</key>
<true/>
<key>com.apple.security.files.user-selected.read-only</key>
<true/>
<key>com.apple.security.network.client</key>
<true/>
<key>com.apple.security.network.server</key>
<true/>
</dict>
</plist>
hope it helps you, too!

Xcode4 derived/build/intermediate products data path: must it really be defined in user settings?

Plenty resources tell how to set these folders, but I am still not satisfied with the infrastructure. What I need is this:
I do not want to use Default folders (as preset in clean Xcode 4 installation, with default Project or Workspace settings).
I want to put them into a dir relative to Project (or Workspace)
Hence I made necessary changes to Project settings, files are being put where expected, but Project as well as Workspace setting, that tells Xcode to put the eproducts where they shell be, are stored in xcuserdata/$USER.xcuserdatad/Workspace{or Project}.settings.
Which (.settings) is naturally unacceptable to be tracked in SCM.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEWorkspaceUserSettings_BuildLocationStyle</key>
<integer>1</integer>
<key>IDEWorkspaceUserSettings_BuildSubfolderNameStyle</key>
<integer>0</integer>
<key>IDEWorkspaceUserSettings_DerivedDataCustomLocation</key>
<string>obj/iphone</string>
<key>IDEWorkspaceUserSettings_DerivedDataLocationStyle</key>
<integer>2</integer>
<key>IDEWorkspaceUserSettings_IssueFilterStyle</key>
<integer>0</integer>
<key>IDEWorkspaceUserSettings_LiveSourceIssuesEnabled</key>
<true/>
<key>IDEWorkspaceUserSettings_SnapshotAutomaticallyBeforeSignificantChanges</key>
<true/>
<key>IDEWorkspaceUserSettings_SnapshotLocationStyle</key>
<integer>0</integer>
</dict>
</plist>
As a result - if there is another checkout made by other user, he opens the Project (or Workspace), ending up with build products being put into default paths (user's home folder), instead of those specified in Workspace{or Project}.settings XML file - because, the xcuserdata/ folder is not tracked and user has different login of course.
I would expect the XML file sibling the contents.xcworspace XML, wiht possibliity to override in user-settings. Obivously, this is not available, at least not documented, is it?
So is there another possibility that would fit my needs?

Resources