Skip to content

Commit

Permalink
Merge pull request #96 from supernotes/fix/openURL
Browse files Browse the repository at this point in the history
Fix deprecated UIApplication.openURL(_:) call
  • Loading branch information
carsten-klaffke authored Nov 29, 2024
2 parents 3a017bf + d3a8f29 commit c7b4534
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -203,15 +203,15 @@ class ShareViewController: UIViewController {
}
}

@objc func openURL(_ url: URL) -> Bool {
@objc func openURL(_ url: URL) {
var responder: UIResponder? = self
while responder != nil {
if let application = responder as? UIApplication {
return application.perform(#selector(openURL(_:)), with: url) != nil
application.open(url, options: [:], completionHandler: nil)
return
}
responder = responder?.next
}
return false
}

}
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ class ShareViewController: UIViewController {
let fileManager = FileManager.default

let copyFileUrl =
fileManager.containerURL(forSecurityApplicationGroupIdentifier: "group.SendIntentExample")!
fileManager.containerURL(forSecurityApplicationGroupIdentifier: "YOUR_APP_GROUP_ID")!
.absoluteString.addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed)!
+ "/screenshot_\(index).png"
do {
Expand Down Expand Up @@ -297,15 +297,15 @@ class ShareViewController: UIViewController {
}
}

@objc func openURL(_ url: URL) -> Bool {
@objc func openURL(_ url: URL) {
var responder: UIResponder? = self
while responder != nil {
if let application = responder as? UIApplication {
return application.perform(#selector(openURL(_:)), with: url) != nil
application.open(url, options: [:], completionHandler: nil)
return
}
responder = responder?.next
}
return false
}

}
Expand Down

0 comments on commit c7b4534

Please sign in to comment.