大多数浏览器和
Developer App 均支持流媒体播放。
-
位置授权的新动向
位置授权开启 2.0 时代。了解用于获得所需授权的全新建议和技巧,以及可在无法达成授权目标时向你发出通知的全新诊断机制。
章节
- 0:00 - Introduction
- 1:52 - Authorization goals
- 9:25 - Session lifecycle
- 13:29 - Diagnostic properties
资源
-
下载Array
-
-
0:31 - CLLocationUpdate and CLMonitor
// Iterating liveUpdates to reflect current location Task { let updates = CLLocationUpdate.liveUpdates() for try await update in updates { if let loc = update.location { updateLocationUI(location: loc) } } } // Iterating monitor events to report condition state changes Task { let monitor = await CLMonitor(monitorName) await monitor.add(CLMonitor.CircularGeographicCondition(center: applePark, radius: 50), identifier: "ApplePark") for try await event in await monitor.events { updateConditionsUI(for: event.identifier, state: event.state) } }
-
0:52 - Handle updates with CLLocationManagerDelegate
// Adapting location authorization to Swift with a MainActor singleton @MainActor class LocationReflector: NSObject, CLLocationManagerDelegate, ObservableObject { static let shared = LocationReflector() private let manager = CLLocationManager() override init() { super.init() manager.delegate = self } func locationManagerDidChangeAuthorization(_ manager: CLLocationManager){ if (manager.authorizationStatus == .notDetermined) { manager.requestWhenInUseAuthorization() } } func locationManager(_ manager: CLLocationManager, didUpdateLocations locations:[CLLocation]) { // Process locations[0] } // ... }
-
1:07 - CLServiceSession simplifies
// CLServiceSession in action Task { let session = CLServiceSession(authorization: .whenInUse) for try await update in CLLocationUpdate.liveUpdates { // Process update.location or update.authorizationDenied } }
-
7:15 - Implicit service sessions
// CLServiceSession in action Task { let session = CLServiceSession(authorization: .whenInUse) for try await update in CLLocationUpdate.liveUpdates { // Process update.location or update.authorizationDenied } }
-
7:34 - Implicit service sessions
Task { for try await update in CLLocationUpdate.liveUpdates { // Process update.location or update.authorizationDenied } }
-
13:37 - Diagnostics – Following the progress of location authorization
// Following the progress of location authorization with CLServiceSession let mySession = CLServiceSession(authorization:.whenInUse) for try await diagnostic in mySession.diagnostics { if (diagnostic.authorizationDenied) { // Ok, let’s let them pick a location instead? } }
-
15:00 - Diagnostics – Following the progress of location authorization
// Following the progress of location authorization with CLServiceSession let mySession = CLServiceSession(authorization:.whenInUse) for try await diagnostic in mySession.diagnostics { if (!diagnostic.authorizationRequestInProgress) { // They’ve decided (maybe already). We can move on! break } }
-
15:25 - Diagnostics – Following the progress of location authorization
// Following the progress of location authorization with CLServiceSession let mySession = CLServiceSession(authorization:.whenInUse) for try await diagnostic in mySession.diagnostics { if (!diagnostic.authorizationRequestInProgress) { reactToChanges(authorized:!diagnostic.authorizationDenied) } }
-
15:46 - Diagnostics – Following the progress of location authorization
// Following the progress of location authorization with CLServiceSession Task { let mySession = CLServiceSession(authorization:.whenInUse) for try await diagnostic in mySession.diagnostics { if (!diagnostic.authorizationRequestInProgress) { reactToChanges(authorized:!diagnostic.authorizationDenied) } } }
-
-
正在查找特定内容?在上方输入一个主题,就能直接跳转到相应的精彩内容。
提交你查询的内容时出现错误。请检查互联网连接,然后再试一次。