当前位置: 首页 > news >正文

建网站要自己买服务器吗网站开发服务转包合同

建网站要自己买服务器吗,网站开发服务转包合同,网站用什么格式的图片格式,优的网站建设明细报价表Overview 概述 [外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-pgnvehxf-1678717852996)(./blog_cover.png)] Core Location 提供的服务可以确定设备的地理位置、高度和方向,或者它相对于附近 iBeacon 设备的位置。 该框架使用设备上的所…

Overview 概述

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-pgnvehxf-1678717852996)(./blog_cover.png)]

Core Location 提供的服务可以确定设备的地理位置、高度和方向,或者它相对于附近 iBeacon 设备的位置。 该框架使用设备上的所有可用组件收集数据,包括 Wi-Fi、GPS、蓝牙、磁力计、气压计和蜂窝硬件。

core class - CLLocationManager 核心类

Declaration 声明

class CLLocationManager : NSObject

Detailed Analysis 详解

是管理应用程序与位置相关的行为的核心类 (central place), 可以借助其 实例对象 来配置、启动和停止位置服务。进而实现如下:

  • Track (跟踪) large or small changes in the user’s current location with a configurable degree of accuracy (准确度/精度).
  • Report heading changes from the onboard compass. (译: 从机载罗盘报告航向变化。)
  • 监视感兴趣的地理区域并在有人进入或离开这些区域时生成事件。
  • Report the range to nearby Bluetooth beacons. (译: 向附近的蓝牙信标报告范围。)

在您的应用程序中创建一个或多个 CLLocationManager 对象,并在需要位置数据的地方使用它们。 创建 CLLocationManager 对象后,对其进行配置,以便 Core Location 知道报告位置更改的频率 (how often to report location changes)。 特别是,使用反映应用需求的值配置 distanceFilterdesiredAccuracy 属性。

Receiving data from location services 数据是怎样传递的 ?

A CLLocationManager object reports all location-related updates to its delegate object, which is an object that conforms to the CLLocationManagerDelegate protocol.

译(zh_CN): CLLocationManager 对象将所有与位置相关的更新报告给它的委托对象,这是一个符合 CLLocationManagerDelegate 协议的对象。

这里有两点需要注意:

⓪. 当 CLLocationManager 对象完成自己的初始化, 会调用代理的locationManagerDidChangeAuthorization(_:)方法上报App的定位权限状态, 所以在配置 CLLocationManager 时要马上指定delegate.

①. delegate方法回调与 CLLocationManager 实例化是同一线程.

官方原文如下

Assign the delegate immediately when you configure your location manager, because the system reports the app’s authorization status to the delegate’s locationManagerDidChangeAuthorization(_😃 method after the location manager finishes initializing itself. Core Location calls the methods of your delegate object using the RunLoop of the thread on which you initialized the CLLocationManager object. That thread must itself have an active RunLoop, like the one found in your app’s main thread.


Determining the availability of services 确定服务的可用性

// significant-change location service 上报明显的位置更新
class func significantLocationChangeMonitoringAvailable() -> Bool// 航向数据可能无法在所有基于 iOS 的设备上使用。在要求位置管理器传递航向相关事件之前,您应该检查此方法返回的值。
class func headingAvailable() -> Bool// 一个布尔值,指示小部件(widget)是否有资格接收位置更新。
var isAuthorizedForWidgetUpdates: Bool { get }//  the level of location accuracy the app has permission to use (App有权使用的定位精度级别)
var accuracyAuthorization: CLAccuracyAuthorization { get }// 能否监控指定的区域(regionClass: A region monitoring class from the MapKit framework. This class must descend from the CLRegion class.)
class func isMonitoringAvailable(for regionClass: AnyClass) -> Bool// 最常用, 系统定位服务是否开启, 如下图所求
class func locationServicesEnabled() -> Bool

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-2QvDdIQA-1678717852996)(./locationServicesEnabled.jpeg)]


Requesting authorization for location services 权限请求

1. 请求 whenInUse 定位权限

func requestWhenInUseAuthorization() 

您必须调用此方法或 requestAlwaysAuthorization() 才能接收与位置相关的信息。 只要当前授权状态未确定 (CLAuthorizationStatus.notDetermined),您就可以调用 requestWhenInUseAuthorization()。

Important

Your app must be in the foreground to show a location authorization prompt.

此方法异步运行 (runs asynchronously) 并提示用户授予应用程序使用位置服务的权限。 用户提示包含来自应用程序 Info.plist 文件中 NSLocationWhenInUseUsageDescription 键 (key) 对应的文本,调用此方法时需要存在该键, 否则会CRASH。 用户提示 (prompt alert window) 显示以下选项,这些选项确定您的 App 可以获取的授权。

OptionAuthorization
Allow While Using AppWhen In Use authorization that does not expire.
Allow OnceTemporary When In Use authorization that expires when the app is no longer in use.
Don’t AllowDenied; no further authorization requests are allowed.

在用户做出选择并确定 (determines) 状态后,位置管理器 (the location manager, 即使 CLLocationManager 实例) 将结果传递给委托的 locationManager(_:didChangeAuthorization:) 方法。 如果方法调用前的初始授权状态不是 CLAuthorizationStatus.notDetermined,则此方法不执行任何操作,也不会调用 locationManager(_:didChangeAuthorization:) 方法。

如果用户的选择向您的应用授予 When In Use 授权,则您的应用可以启动任何位置服务,并且有资格在使用时接收结果。 如果用户选择授予临时使用时授权,则当应用程序不再使用时授权将过期,恢复为未确定状态 (CLAuthorizationStatus.notDetermined)。

有关应用程序何时被视为 whenInUse 的信息,请参阅 Choosing the Location Services Authorization to Request。

前台启动定位服务 Vs 后台启动定位服务
  • foreground starts: 当您的应用程序在前台启动标准位置服务时,如果您的应用程序在 Xcode 项目的功能选项卡中启用了后台位置更新,它们将继续在后台运行。当您的应用移动到具有活动位置服务的后台时 (moves to the background with active location services),系统会在状态栏中显示位置服务指示器 (indicator)。
  • background starts: 当您的应用程序在后台运行时尝试启动位置更新将失败。

Note

在 iOS 16 及更高版本中,主动跟踪用户位置或最近启用核心位置的应用程序会在控制中心显示一个指示器 (在最顶部🔝)。 通过仅在必要时和用户期望时监视设备的位置,注意电池使用和用户隐私。

2. 请求 Always 权限

func requestAlwaysAuthorization()
Discussion 讨论

要调用此方法,您必须在应用的 Info.plist 文件中同时拥有 NSLocationAlwaysUsageDescription 和 NSLocationWhenInUseUsageDescription 键。 当前授权状态为以下任一状态时,您才可以调用:

  • Not Determined — CLAuthorizationStatus.notDetermined
  • When In Use — CLAuthorizationStatus.authorizedWhenInUse

当用户做出权限选择时,使用 CLLocationManager 委托上的 locationManager(_:didUpdateLocations:) 方法接收更新。

Core Location 限制对 requestAlwaysAuthorization() 的调用。 在您的应用程序调用此方法后,进一步的调用无效。

Request Always Authorization After Getting When In Use

要获得 Always 授权,您的应用必须首先请求 When In Use 权限,然后再请求 Always 授权。

如果用户在您的应用程序调用 requestWhenInUseAuthorization() 后授予 When In Use 权限,则调用 requestAlwaysAuthorization() 会立即提示用户请求 Always 权限。 如果用户使用 Allow Once 响应 requestWhenInUseAuthorization(),则 Core Location 会由于临时授权而忽略对 requestAlwaysAuthorization() 的进一步调用。

Core Location 提示用户使用来自 NSLocationAlwaysUsageDescription 的字符串授予权限。 用户提示显示以下选项,这些选项确定您的应用程序可以获得的授权:

OptionAuthorization
Keep Only While UsingCore Location leaves the authorization as When In Use. The delegate doesn’t receive any updates.
Change to Always AllowCore Location grants your app Always authorization. The delegate recieves CLAuthorizationStatus.authorizedAlways.
Request Always Authorization Directly

如果您的应用程序的当前状态为 CLAuthorizationStatus.notDetermined 并且您调用了 requestAlwaysAuthorization(),则 Core Location 在完全启用 Always 授权之前会使用两个提示。

第一个提示立即显示 NSLocationWhenInUseUsageDescription 中的字符串。 用户提示显示以下选项,这些选项确定您的应用程序收到的授权:

OptionAuthorization
Allow While Using AppCore Location grants your app a Provisional Always authorization. The delegate receives CLAuthorizationStatus.authorizedAlways.
Allow OnceCore Location grants your app a Temporary When in Use authorization. The delegate receives CLAuthorizationStatus.authorizedWhenInUse. This authorization expires when your app is no longer in use, reverting to CLAuthorizationStatus.notDetermined.
Don’t AllowCore Location marks your app with Denied authorization. The delegate receives CLAuthorizationStatus.denied.

当 Core Location 准备向需要 CLAuthorizationStatus.authorizedAlways 的应用程序传递事件时,会显示第二个提示。 如果应用程序处于 Provisional Always 状态,系统会显示第二个提示,其中包含来自 NSLocationAlwaysUsageDescription 的字符串。 当您的应用未运行时,Core Location 通常会显示第二个提示。

如果用户在临时始终状态下出现第二个提示时选择授予权限,您的应用程序将获得永久始终授权。 当用户响应时,您的应用会收到位置事件或使用修改后的授权调用您的委托。

当显示第二个提示时,用户会看到以下选项之一:

OptionAuthorization
Keep Only While UsingCore Location changes the authorization to When In Use. The delegate receives CLAuthorizationStatus.authorizedWhenInUse.
Change to Always AllowCore Location removes the provisional status, making the Always authorization permanent. The delegate doesn’t receive a callback.

如果用户在接近交付时间 (the time it was delivered) 响应提示并选择允许 Always 权限,则位置事件将发送到您的应用程序。

http://www.yayakq.cn/news/826806/

相关文章:

  • vs和sql怎么做网站wordpress发表图片
  • 做视频有收益的网站河北网站备案注销
  • 怎样建免费网站学校网站设计实验报告
  • 电子商务网站建设估算温州优化售后
  • 网站开发试题东莞重大项目建设
  • 枣庄网站建设wordpress链接亚马逊
  • 预付做网站订金怎么做账wordpress建站企业站
  • centos7安装 wordpress如何对一个网站进行seo
  • 小学网站建设设计方案常平营销网站建设
  • 介绍国外的网站有什么不同wordpress换身 变身
  • 网站动效网站建设要注意哪些
  • 线上名片制作优化系统流程
  • 企业网站代码html基于大数据的精准营销
  • 彩票网站建设方案2020十大网络安全公司排名
  • 英国男女做那个视频网站互动科技 网站
  • 一个ip做几个网站吗手机自己做网站吗
  • 网站开发入哪个会计科目做网站要学什么c语言
  • 织梦cms网站分页打不开怎么做网站赚钱放广告
  • 建站公司网站社区酒店电子商务网站建设
  • php 网站缓存文件互动平台是什么意思
  • 泰安做网站网络公司绵阳网站建设工作室
  • 网站建设丶金手指花总13手机上上建设网站
  • 汽车网站建设策划书专业企业网站设计服务公司
  • php做网站还是linux网络信息有限公司
  • asp添加网站管理员开发小程序需要的技术
  • 潍坊网站空间济南网站建设 力选聚搜网络
  • 加强网站建设的建议免费找客户的软件
  • 徐州哪家公司做网站水平好python基础教程期末考试
  • 建设网站哪里好网站建设流程 文档
  • 做网站公司推荐企业信用信息查询公示系统浙江