質問編集履歴
1
コード修正しました
title
CHANGED
File without changes
|
body
CHANGED
@@ -4,17 +4,25 @@
|
|
4
4
|
原因はdocInteractionControllerが破棄されたいたからのようでdocInteractionControllerをインスタンス変数にすることでファイル共有ができるようになったのですが、このdocInteractionControllerはどのタイミングで破棄すればいいのでしょうか?
|
5
5
|
|
6
6
|
###該当のソースコード
|
7
|
-
|
7
|
+
```
|
8
|
-
NSURL *url = [NSURL fileURLWithPath:filePath];
|
9
|
-
UIDocumentInteractionController docInteractionController= [UIDocumentInteractionController interactionControllerWithURL:url];
|
10
|
-
docInteractionController.delegate = self;
|
11
8
|
|
9
|
+
@implementation ViewController
|
10
|
+
- (IBAction)tappedButton:(UIButton *)button
|
11
|
+
{
|
12
|
+
NSString *filePath = ファイルパス...;
|
13
|
+
NSURL *url = [NSURL fileURLWithPath:filePath];
|
14
|
+
UIDocumentInteractionController *docInteractionController
|
15
|
+
= [UIDocumentInteractionController interactionControllerWithURL:url];
|
16
|
+
docInteractionController.delegate = self;
|
17
|
+
|
12
|
-
BOOL result = [docInteractionController presentOptionsMenuFromRect:
|
18
|
+
BOOL result = [docInteractionController presentOptionsMenuFromRect:button.frame inView:self.view animated:YES];
|
13
|
-
|
19
|
+
|
14
|
-
if (!result){
|
20
|
+
if (!result){
|
15
|
-
|
21
|
+
// アラート表示...
|
22
|
+
}
|
16
23
|
}
|
17
24
|
|
25
|
+
```
|
18
26
|
###補足情報(言語/FW/ツール等のバージョンなど)
|
19
27
|
環境Xcode9.0
|
20
28
|
言語Objective-C
|