首页 > 解决方案 > iOS | 如何以编程方式打开谷歌课堂应用程序

问题描述

我想通过我现有的 iOS 应用程序单击按钮打开谷歌课堂应用程序(如果设备上提供课堂应用程序)。

谷歌教室的任何 URL 方案?

我没有在 URL 上找到任何 Google Classroom 应用程序 URL 方案: https ://gist.github.com/bartleby/6588aa4782dfb3f1d50c23ce9a4554e3 https://ios.gadgethacks.com/news/always-updated-list-ios-app-url -方案名称-0184033/

LSApplicationWorkspace 是一个私有 API,所以我不能使用它。

我可以打开 Google Classroom 应用程序的 AppStore 链接并从那里打开应用程序,但我正在寻找一种直接的方法,例如(URL Scheme、Bundle Identifier 等)。

提前致谢!

标签: iosswiftxcodegoogle-classroomios-urlsheme

解决方案


如果您的 iPhone 上安装了课堂应用程序,则在 Safari 中打开您的 Classroom 课程 URL,它将打开您的 Classroom 应用程序,否则 safari 将为您提供在 AppStore 上查看应用程序的选项。

UIApplication.shared.open(URL(string: "your_url_str")!, options: [:], completionHandler: nil)

确保将登录 ID 号替换为实际的电子邮件 ID。

Ex: 
https://classroom.google.com/u/<EMAIL_ID HAVING COURSE ACCESS>/w/<Course Id>/t/all

虚拟网址:

https://classroom.google.com/u/demo@gmail.com/w/nbmbms8709s/t/all

推荐阅读