回答編集履歴
2
追記
test
CHANGED
@@ -1,11 +1,47 @@
|
|
1
|
-
たぶんこれですかねー。
|
1
|
+
~~たぶんこれですかねー。~~
|
2
2
|
|
3
|
-
[UIDocumentBrowserViewController](https://developer.apple.com/documentation/uikit/uidocumentbrowserviewcontroller)
|
3
|
+
~~[UIDocumentBrowserViewController](https://developer.apple.com/documentation/uikit/uidocumentbrowserviewcontroller)~~
|
4
4
|
|
5
5
|
|
6
6
|
|
7
7
|
追記:
|
8
8
|
|
9
|
-
|
9
|
+
すみません、たぶんこっちです。
|
10
10
|
|
11
11
|
[UIDocumentPickerViewController](https://developer.apple.com/documentation/uikit/uidocumentpickerviewcontroller)
|
12
|
+
|
13
|
+
|
14
|
+
|
15
|
+
適当に検証した感じ、外部のPDFファイルのurlが取れました。
|
16
|
+
|
17
|
+
```swift
|
18
|
+
|
19
|
+
import UIKit
|
20
|
+
|
21
|
+
|
22
|
+
|
23
|
+
class ViewController: UIViewController, UIDocumentPickerDelegate {
|
24
|
+
|
25
|
+
|
26
|
+
|
27
|
+
override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
|
28
|
+
|
29
|
+
let vc = UIDocumentPickerViewController(documentTypes: ["com.adobe.pdf"], in: .open) // とりあえずPDFを指定。.open以外にも.importとかいろいろあるので適宜変えてください。
|
30
|
+
|
31
|
+
vc.delegate = self
|
32
|
+
|
33
|
+
present(vc, animated: true, completion: nil)
|
34
|
+
|
35
|
+
}
|
36
|
+
|
37
|
+
|
38
|
+
|
39
|
+
func documentPicker(_ controller: UIDocumentPickerViewController, didPickDocumentAt url: URL) {
|
40
|
+
|
41
|
+
print(url) // ここにURLが入っている
|
42
|
+
|
43
|
+
}
|
44
|
+
|
45
|
+
}
|
46
|
+
|
47
|
+
```
|
1
追記
test
CHANGED
@@ -4,4 +4,8 @@
|
|
4
4
|
|
5
5
|
|
6
6
|
|
7
|
+
追記:
|
8
|
+
|
7
|
-
|
9
|
+
ひょっとしたらこっちなのかも。。
|
10
|
+
|
11
|
+
[UIDocumentPickerViewController](https://developer.apple.com/documentation/uikit/uidocumentpickerviewcontroller)
|