在Configure and link your app clips的视频中,苹果公司表示,根据用户的位置,Siri可以向你推荐你的AppClip。
我在文档https://developer.apple.com/documentation/app_clips里找不到这个
这是纯粹基于其他用户使用此应用程序的位置,还是开发人员可以配置(可能基于地理编码区域)?
发布于 2020-07-07 04:36:03
据我在WWDC采访的一位苹果应用剪辑工程师说,为了让你的应用剪辑发布到苹果地图上,你需要在苹果注册业务。从iOS 10开始,通过Apple Maps Connect就可以做到这一点,并注册为小企业。
附近的Siri建议是基于位置数据的,只有当你的应用程序剪辑与苹果地图上的位置卡关联时才会出现,所以你无法控制这一点。下载应用程序剪辑后,绝对可以获取用户位置,如下面的demo所示,但从您的问题中,我推测您希望在下载之前显示应用程序剪辑建议(不在开发人员的控制范围内)。
如果您想要将应用程序剪辑注册到某个位置,则需要等待应用程序剪辑完全可用并可在App Store上发布。当TestFlight和App Store Connect在今年晚些时候获得对应用程序剪辑的支持时,您将能够从近场通信、二维码、地图等调用应用程序剪辑。因此,您需要向Apple注册您的业务,在Apple Maps中注册您的placecard,然后启用App Clip来获得建议。
发布于 2020-07-02 12:36:09
文档还没有详细介绍,但您可以在此处阅读:https://developer.apple.com/documentation/app_clips
还有这里的https://developer.apple.com/documentation/app_clips/configuring_your_app_clip_s_launch_experience
在“查看高级应用剪辑体验”下
您应该能够将您的应用程序剪辑与物理位置相关联,这将在AppStore连接中可用,并且使用此设置,Siri建议应该能够根据用户位置拾取您的应用程序剪辑
发布于 2020-07-05 04:24:31
有一个示例代码文档页面,其中的代码中包含小部件和应用程序剪辑:https://developer.apple.com/documentation/swiftui/fruta_building_a_feature-rich_app_with_swiftui
在上面App Clip代码部分的链接中,有一个可以配置纬度和经度的有效负载。Siri应该会根据你输入的纬度和经度自动推荐应用程序剪辑。
#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
代码片段来自上面链接中的文档。
https://stackoverflow.com/questions/62559071
复制相似问题