ContentRestrictionsKit
特点
- 获取设备的电影评级限制设置(原始值或文本值)
- 获取提供的电影评级的原始值(目前仅支持US评级)
- 确定提供的电影评级是否受设备限制允许(同样,仅限US)
电影评级
获取设备上的电影评级限制设置
ContentRestrictionsKit.Movie.getDeviceRestrictionValue()
返回设备上电影评级限制的原始值(整数值0-1000)
ContentRestrictionsKit.Movie.getDeviceRestriction(country: .US)
返回设备上电影评级限制的名称值
获取电影评分值
ContentRestrictionsKit.Movie.getRatingValue(country: .US, rating: "r") // 400
返回提供的电影评分的原始值(整数值 0-1000)
电影评分是否允许
ContentRestrictionsKit.Movie.ratingIsAllowed(country: .US, rating: "r") // returns Bool
返回 true/false,以确定提供的评分是否被设备的电影限制评分允许
电视节目评分
获取设备电视节目评分限制设置
ContentRestrictionsKit.TVShow.getDeviceRestrictionValue()
返回设备上电视节目评分限制的原生值(整数值 0-1000)
ContentRestrictionsKit.TVShow.getDeviceRestriction(country: .US)
返回设备上电视节目评分限制的名称值
获取电视节目评分值
ContentRestrictionsKit.TVShow.getRatingValue(country: .US, rating: "tvpg") // 400
返回提供的电视节目评分的原始值(整数值 0-1000)
电视节目评分是否允许
ContentRestrictionsKit.TVShow.ratingIsAllowed(country: .US, rating: "tvpg") // returns Bool
返回 true/false,以确定提供的评分是否被设备的电视节目限制评分允许
App 评分
获取设备 App 评分限制设置
ContentRestrictionsKit.App.getDeviceRestrictionValue()
返回设备上游的 App 评分限制的原始值(整数值 0-1000)
ContentRestrictionsKit.App.getDeviceRestriction()
返回设备上游的 App 评分限制的名称值
获取 App 评分值
ContentRestrictionsKit.App.getRatingValue(rating: "12+") // 300
返回提供的 App 评分的原始值(整数值 0-1000)
App 评分是否允许
ContentRestrictionsKit.App.ratingIsAllowed(rating: "12+") // returns Bool
返回提供的评分是否被设备 App 限制评分允许
明确限制
明确音乐允许
ContentRestrictionsKit.Explicit.isExplicitMusicAllowed() // returns Bool
返回设备上是否允许明确音乐、播客和新闻
明确书籍允许
ContentRestrictionsKit.Explicit.isExplicitBooksAllowed() // returns Bool
返回true/false,表示设备是否允许显式书籍
安装
ContentRestrictionsKit可以通过CocoaPods获取。要安装它,只需在Podfile中添加以下行
pod 'ContentRestrictionsKit'
计划中功能
- 电视节目评分
- 应用评分
- 允许显式书籍
- 允许显式音乐播客
- 游戏评分(映射到最接近的应用评分)
目前支持国家
(欢迎发送有关新国家的信息,通过issue请求新国家或通过pull request贡献。针对特定国家收集信息非常耗时,因此只有经过请求才会添加额外的国家。)
- 美国(US)