Skip to content
This repository was archived by the owner on Apr 7, 2021. It is now read-only.

Commit cfbb44a

Browse files
committed
fix canOpenURL studyplus
1 parent 6048627 commit cfbb44a

File tree

2 files changed

+13
-9
lines changed

2 files changed

+13
-9
lines changed

Demo/Info.plist

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
33
<plist version="1.0">
44
<dict>
5+
<key>LSApplicationQueriesSchemes</key>
6+
<array>
7+
<string>studyplus</string>
8+
</array>
59
<key>CFBundleDevelopmentRegion</key>
610
<string>en</string>
711
<key>CFBundleExecutable</key>

StudyplusSDK/Studyplus.swift

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -299,20 +299,20 @@ final public class Studyplus {
299299

300300
private func openStudyplus(command: String) {
301301

302-
let urlString: String = "studyplus://external_app/" + command + "/" + consumerKey + "/" + consumerSecret
303-
304-
if let url = URL(string: urlString) {
305-
306-
applicationOpen(url)
307-
308-
} else {
309-
302+
guard UIApplication.shared.canOpenURL(URL(string: "studyplus://")!) else {
310303
if self.openAppStoreIfNotInstalled {
311-
312304
let appStoreURLString: String = "https://apps.apple.com/jp/app/id505410049?mt=8"
313305
guard let appStoreURL = URL(string: appStoreURLString) else { return }
314306
applicationOpen(appStoreURL)
315307
}
308+
return
309+
}
310+
311+
let urlString: String = "studyplus://external_app/" + command + "/" + consumerKey + "/" + consumerSecret
312+
313+
if let url = URL(string: urlString) {
314+
315+
applicationOpen(url)
316316
}
317317
}
318318

0 commit comments

Comments
 (0)