I have an iOS app, which requests location permissions. If the user accepts, everything works fine (of course). But if the user doesn't accept and then manually triggers a localisation, he get the dialog provided by Apple to change the settings for the app in the Settings-App.
But if the user clicks on Settings
, it just opens the Settings-App without jumping to the settings of my App. The app is also not listed in the Settings-App mainscreen, but can be found under Privacy -> Location Services
.
But once you accept the location (or any other) permissions, the app appears in the Settings and the links work fine.
NSLocationAlwaysAndWhenInUseUsageDescription
is included in the pList.
Any ideas on how to guarantee the to appear in the Settings-App mainscreen?
You need to add a Settings.bundle: Xcode > File > New > File > iOS > Settings Bundle. This way your app is always going to show up in Settings.app.
Bonus:
Q: What to use Settings.bundle for?
A: Show app version.
It should look like this: Root.plist
Then, add a script to auto update version:
Select Project in Xcode.
In Targets select your app target.
Select Build Phases tab.
Press (+) > New Run Phase Script.
Configure Script:
Name Script "Settings.bundle"
Unclick "Run Script: Base on dependency analysis.
Paste script into form under "Shell /bin/sh":
if [[ $TARGET_BUILD_DIR != *"maccatalyst"* ]]; then
plistBuddy=/usr/libexec/PlistBuddy
infoPlistPath="${TARGET_BUILD_DIR}/${INFOPLIST_PATH}"
settingsBundlePath="${TARGET_BUILD_DIR}/${CONTENTS_FOLDER_PATH}/Settings.bundle/Root.plist"
versionNumber=$($plistBuddy -c "Print :CFBundleShortVersionString" "$infoPlistPath")
$plistBuddy -c "Set PreferenceSpecifiers:0:DefaultValue $versionNumber" "$settingsBundlePath"
fi