iOS中,访问系统隐私权限时修改alert文案的方法

2024-03-20 07:58

本文主要是介绍iOS中,访问系统隐私权限时修改alert文案的方法,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

开发过程中,难免会涉及到访问相册、相机、麦克风、通讯录等需要进行隐私权限授权的功能。

系统默认的alert比较生硬,像下图这样:



其实我们是可以向其中加入自定义的文案的。

加入之后看上去会更友好,像下图这样:



方法很简单,只需要向info.plist里加一行键值就行了。

例如修改通讯录权限的,Key为NSContactsUsageDescription(或 Privacy - Contacts Usage Description),Value写入你想要添加的文案就可以了。


附上官方文档地址,其它权限的键可以在里面找。

https://developer.apple.com/library/mac/documentation/General/Reference/InfoPlistKeyReference/Articles/CocoaKeys.html


Table 1  Summary of Cocoa keys

Key

Xcode name

Summary

Platforms

GKGameCenterBadgingDisabled

(none)

Specifies whether your app is badged. See GKGameCenterBadgingDisabled for details.

iOS 7.0 and later

GKShowChallengeBanners

(none)

Specifies whether banners are shown within an app. See GKShowChallengeBannersfor details.

iOS 7.0 and later

NSAppleScriptEnabled

“Scriptable”

Specifies whether AppleScript is enabled. See NSAppleScriptEnabled for details.

OS X

NSAppTransportSecurity

(none)

Specifies exceptions to the default strong Internet security in iOS and OS X apps and in app extensions. SeeNSAppTransportSecurity for details.

iOS 9.0 and later, OS X v10.11 and later

NSBluetoothPeripheralUsageDescription

“Privacy - Bluetooth Peripheral Usage Description”

Specifies the reason for using Bluetooth. See NSBluetoothPeripheralUsageDescription for details.

iOS 6.0 and later

NSCalendarsUsageDescription

“Privacy - Calendars Usage Description”

Specifies the reason for accessing the user’s calendars. See NSCalendarsUsageDescription for details.

iOS 6.0 and later

NSCameraUsageDescription

“Privacy - Camera Usage Description”

Specifies the reason for accessing the device’s camera. See NSLocationAlwaysUsageDescription for details.

iOS 7.0 and later

NSContactsUsageDescription

“Privacy - Contacts Usage Description”

Specifies the reason for accessing the user’s contacts. See NSContactsUsageDescription for details.

iOS 6.0 and later, OS X v10.8 and later

NSDockTilePlugIn

”Dock Tile Plugin path”

Specifies the name of app’s Dock tile plug-in, if present. See NSDockTilePlugIn for details.

OS X

NSHumanReadableCopyright

“Copyright (human-readable)”

(Localizable) Specifies the copyright notice for the bundle. See NSHumanReadableCopyright for details.

OS X

NSJavaNeeded

“Cocoa Java application”

Specifies whether the program requires a running Java VM. See NSJavaNeeded for details.

OS X

NSJavaPath

“Java classpaths”

An array of paths to classes whose components are preceded by NSJavaRoot. SeeNSJavaPath for details.

OS X

NSJavaRoot

“Java root directory”

The root directory containing the java classes. See NSJavaRoot for details.

OS X

NSLocationAlwaysUsageDescription

(none)

Specifies the reason for accessing the user’s location information. See NSLocationAlwaysUsageDescription for details.

iOS 8.0 and later, OS X v10.10 and later

NSLocationUsageDescription

“Privacy - Location Usage Description”

Specifies the reason for accessing the user’s location information. See NSLocationUsageDescription for details.

iOS 6.0 and later, OS X v10.9 and later

NSLocationWhenInUseUsageDescription

(none)

Specifies the reason for accessing the user’s location information. See NSLocationWhenInUseUsageDescription for details.

iOS 8.0 and later, OS X v10.10 and later

NSMainNibFile

“Main nib file base name”

The name of an app’s main nib file. SeeNSMainNibFile for details.

iOS, OS X

NSMicrophoneUsageDescription

“Privacy - Microphone Usage Description”

Specifies the reason for accessing the device’s microphone. See NSCalendarsUsageDescription for details.

iOS 7.0 and later

NSMotionUsageDescription

“Privacy - Motion Usage Description”

Specifies the reason for accessing the device’s accelerometer. See NSMotionUsageDescription for details.

iOS 7.0 and later

NSPersistentStoreTypeKey

“Core Data persistent store type”

The type of Core Data persistent store associated with a persistent document type. SeeNSPersistentStoreTypeKey for details.

OS X

NSPhotoLibraryUsageDescription

“Privacy - Photo Library Usage Description”

Specifies the reason for accessing the user’s photo library. See NSPhotoLibraryUsageDescription for details.

iOS 6.0 and later

NSPrefPaneIconFile

“Preference Pane icon file”

The name of an image file resource used to represent a preference pane in the System Preferences app. SeeNSPrefPaneIconFile for details.

OS X

NSPrefPaneIconLabel

“Preference Pane icon label”

The name of a preference pane displayed beneath the preference pane icon in the System Preferences app. SeeNSPrefPaneIconLabel for details.

OS X

NSPrincipalClass

“Principal class”

The name of the bundle’s main class. See NSPrincipalClass for details.

OS X

NSRemindersUsageDescription

“Privacy - Reminders Usage Description”

Specifies the reason for accessing the user’s reminders. See NSRemindersUsageDescription for details.

iOS 6.0 and later

NSServices

“Services”

An array of dictionaries specifying the services provided by an app. See NSServices for details.

OS X

NSSupportsAutomaticTermination

(none)

Specifies whether the app may be killed to reclaim memory. See NSSupportsAutomaticTermination for details.

OS X v10.7 and later

NSSupportsSuddenTermination

(none)

Specifies whether the app may be killed to allow for faster shut down or log out operations. SeeNSSupportsSuddenTermination for details.

OS X

NSUbiquitousContainer

(none)

Specifies the iCloud Drive settings for each container. See NSUbiquitousContainers for details.

iOS, OS X

NSUbiquitousContainerIsDocumentScopePublic

(none)

Specifies whether the iCloud Drive should share the contents of this container. SeeNSUbiquitousContainerIsDocumentScopePublic for details.

iOS, OS X

NSUbiquitousContainerName

(none)

Specifies the name that the iCloud Drive displays for your container. See NSUbiquitousContainerName for details.

iOS, OS X

NSUbiquitousContainerSupportedFolderLevels

(none)

Specifies the maximum number of folder levels inside your container’s Documents directory. SeeNSUbiquitousContainerSupportedFolderLevels for details.

iOS, OS X

NSUbiquitousDisplaySet

(none)

Specifies the mobile document data that the app can view. See NSUbiquitousDisplaySet for details.

iOS, OS X

NSUserActivityTypes

(none)

Specifies the user activity types that the app supports. See NSUserActivityTypes for details.

iOS, OS X

NSUserNotificationAlertStyle

(none)

Specifies whether the notification style should be banner, alert, or none. The default value is banner, which is the recommended style. SeeNSUserNotificationAlertStyle for details.

OS X

UTExportedTypeDeclarations

“Exported Type UTIs”

An array of dictionaries specifying the UTI-based types supported (and owned) by the app. SeeUTExportedTypeDeclarations for details.

iOS 5.0 and later, OS X v10.7 and later

UTImportedTypeDeclarations

“Imported Type UTIs”

An array of dictionaries specifying the UTI-based types supported (but not owned) by the app. SeeUTImportedTypeDeclarations for details.

iOS, OS X


这篇关于iOS中,访问系统隐私权限时修改alert文案的方法的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/828790

相关文章

不懂推荐算法也能设计推荐系统

本文以商业化应用推荐为例,告诉我们不懂推荐算法的产品,也能从产品侧出发, 设计出一款不错的推荐系统。 相信很多新手产品,看到算法二字,多是懵圈的。 什么排序算法、最短路径等都是相对传统的算法(注:传统是指科班出身的产品都会接触过)。但对于推荐算法,多数产品对着网上搜到的资源,都会无从下手。特别当某些推荐算法 和 “AI”扯上关系后,更是加大了理解的难度。 但,不了解推荐算法,就无法做推荐系

基于人工智能的图像分类系统

目录 引言项目背景环境准备 硬件要求软件安装与配置系统设计 系统架构关键技术代码示例 数据预处理模型训练模型预测应用场景结论 1. 引言 图像分类是计算机视觉中的一个重要任务,目标是自动识别图像中的对象类别。通过卷积神经网络(CNN)等深度学习技术,我们可以构建高效的图像分类系统,广泛应用于自动驾驶、医疗影像诊断、监控分析等领域。本文将介绍如何构建一个基于人工智能的图像分类系统,包括环境

水位雨量在线监测系统概述及应用介绍

在当今社会,随着科技的飞速发展,各种智能监测系统已成为保障公共安全、促进资源管理和环境保护的重要工具。其中,水位雨量在线监测系统作为自然灾害预警、水资源管理及水利工程运行的关键技术,其重要性不言而喻。 一、水位雨量在线监测系统的基本原理 水位雨量在线监测系统主要由数据采集单元、数据传输网络、数据处理中心及用户终端四大部分构成,形成了一个完整的闭环系统。 数据采集单元:这是系统的“眼睛”,

嵌入式QT开发:构建高效智能的嵌入式系统

摘要: 本文深入探讨了嵌入式 QT 相关的各个方面。从 QT 框架的基础架构和核心概念出发,详细阐述了其在嵌入式环境中的优势与特点。文中分析了嵌入式 QT 的开发环境搭建过程,包括交叉编译工具链的配置等关键步骤。进一步探讨了嵌入式 QT 的界面设计与开发,涵盖了从基本控件的使用到复杂界面布局的构建。同时也深入研究了信号与槽机制在嵌入式系统中的应用,以及嵌入式 QT 与硬件设备的交互,包括输入输出设

JAVA智听未来一站式有声阅读平台听书系统小程序源码

智听未来,一站式有声阅读平台听书系统 🌟 开篇:遇见未来,从“智听”开始 在这个快节奏的时代,你是否渴望在忙碌的间隙,找到一片属于自己的宁静角落?是否梦想着能随时随地,沉浸在知识的海洋,或是故事的奇幻世界里?今天,就让我带你一起探索“智听未来”——这一站式有声阅读平台听书系统,它正悄悄改变着我们的阅读方式,让未来触手可及! 📚 第一站:海量资源,应有尽有 走进“智听

【C++】_list常用方法解析及模拟实现

相信自己的力量,只要对自己始终保持信心,尽自己最大努力去完成任何事,就算事情最终结果是失败了,努力了也不留遗憾。💓💓💓 目录   ✨说在前面 🍋知识点一:什么是list? •🌰1.list的定义 •🌰2.list的基本特性 •🌰3.常用接口介绍 🍋知识点二:list常用接口 •🌰1.默认成员函数 🔥构造函数(⭐) 🔥析构函数 •🌰2.list对象

安卓链接正常显示,ios#符被转义%23导致链接访问404

原因分析: url中含有特殊字符 中文未编码 都有可能导致URL转换失败,所以需要对url编码处理  如下: guard let allowUrl = webUrl.addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed) else {return} 后面发现当url中有#号时,会被误伤转义为%23,导致链接无法访问

浅谈主机加固,六种有效的主机加固方法

在数字化时代,数据的价值不言而喻,但随之而来的安全威胁也日益严峻。从勒索病毒到内部泄露,企业的数据安全面临着前所未有的挑战。为了应对这些挑战,一种全新的主机加固解决方案应运而生。 MCK主机加固解决方案,采用先进的安全容器中间件技术,构建起一套内核级的纵深立体防护体系。这一体系突破了传统安全防护的局限,即使在管理员权限被恶意利用的情况下,也能确保服务器的安全稳定运行。 普适主机加固措施:

webm怎么转换成mp4?这几种方法超多人在用!

webm怎么转换成mp4?WebM作为一种新兴的视频编码格式,近年来逐渐进入大众视野,其背后承载着诸多优势,但同时也伴随着不容忽视的局限性,首要挑战在于其兼容性边界,尽管WebM已广泛适应于众多网站与软件平台,但在特定应用环境或老旧设备上,其兼容难题依旧凸显,为用户体验带来不便,再者,WebM格式的非普适性也体现在编辑流程上,由于它并非行业内的通用标准,编辑过程中可能会遭遇格式不兼容的障碍,导致操

【区块链 + 人才服务】可信教育区块链治理系统 | FISCO BCOS应用案例

伴随着区块链技术的不断完善,其在教育信息化中的应用也在持续发展。利用区块链数据共识、不可篡改的特性, 将与教育相关的数据要素在区块链上进行存证确权,在确保数据可信的前提下,促进教育的公平、透明、开放,为教育教学质量提升赋能,实现教育数据的安全共享、高等教育体系的智慧治理。 可信教育区块链治理系统的顶层治理架构由教育部、高校、企业、学生等多方角色共同参与建设、维护,支撑教育资源共享、教学质量评估、