1

Appleのビデオ「アプリ クリップを構成してリンクする」では、ユーザーの場所に基づいて Siri が AppClip を提案することが可能であることが示されています。

ドキュメントでこれを見つけることができませんhttps://developer.apple.com/documentation/app_clips

これは純粋に他のユーザーがこのアプリを使用している場所に基づいているのでしょうか、それとも開発者が構成できるものですか (ジオコード領域に基づいている可能性があります)?

iOS 14 - Siri の AppClip 付近の提案

4

3 に答える 3

0

コードにウィジェットと App Clip を含むサンプル コード ドキュメント ページがあります: https://developer.apple.com/documentation/swiftui/fruta_building_a_feature-rich_app_with_swiftui

上記の App Clip コード セクションのリンクには、緯度と経度を構成可能なペイロードがあります。Siri は、緯度と経度に入力した場所に基づいて、App Clip を自動的に提案するはずです。

#if APPCLIP
func handleUserActivity(_ userActivity: NSUserActivity) {
    guard let incomingURL = userActivity.webpageURL,
          let components = NSURLComponents(url: incomingURL, resolvingAgainstBaseURL: true),
          let queryItems = components.queryItems else {
        return
    }
    if let smoothieID = queryItems.first(where: { $0.name == "smoothie" })?.value {
        model.selectSmoothie(id: smoothieID)
    }
    guard let payload = userActivity.appClipActivationPayload,
          let latitudeValue = queryItems.first(where: { $0.name == "latitude" })?.value,
          let longitudeValue = queryItems.first(where: { $0.name == "longitude" })?.value,
          let latitude = Double(latitudeValue), let longitude = Double(longitudeValue) else {
        return
    }
    let region = CLCircularRegion(center: CLLocationCoordinate2D(latitude: latitude,
                        longitude: longitude), radius: 100, identifier: "smoothie_location")
    payload.confirmAcquired(in: region) { inRegion, error in
        if let error = error {
            print(error.localizedDescription)
            return
        }
        DispatchQueue.main.async {
            model.applePayAllowed = inRegion
        }
    }
}
#endif

コード スニペットは、上記のリンクのドキュメントからのものです。

于 2020-07-04T20:24:31.107 に答える