首页 > 解决方案 > 如何通过 Link 或 URLScheme 搜索 TV App?

问题描述

希望自动将搜索传递到 iOS 上的 Apple TV 应用程序,已将其打开到搜索页面,但没有任何特定文本。

 Button {
      let titleReformatted = title.replacingOccurrences(of: "?", with: "%3F").replacingOccurrences(of: " ", with: "%20")
      UIApplication.shared.open(URL(string: "https://tv.apple.com/us/search?q=\(titleReformatted)")!)        
     } label: {
       Label("Where to Watch", systemImage: "appletv.fill")
     }

我尝试过的其他链接包括“https://tv.apple.com/us/search/(titleReformatted), https://tv.apple.com/us/search=\(titleReformatted) , https://tv .apple.com/us/\(titleReformatted)/search"但我找不到一个有效的。

标签: iosswiftxcodeswiftuiswift5

解决方案


推荐阅读