質問編集履歴

2

質問への追記

2018/12/22 03:22

投稿

vsmorse
vsmorse

スコア68

test CHANGED
File without changes
test CHANGED
@@ -91,3 +91,39 @@
91
91
  macos Mojave version 10.14.1
92
92
 
93
93
  Xcode Version 10.1(10B61)
94
+
95
+ ※ファイルのパスを直書きしていますが、個人で使用するソフトウェアなので問題ありません。 
96
+
97
+ ###追記(MasakiHoriさんより)
98
+
99
+ > catch内をprint(error)に変えて出力されたエラーを質問に追加してください
100
+
101
+ ```Swift
102
+
103
+ let myImageData = AVCaptureStillImageOutput.jpegStillImageNSDataRepresentation(imageDataBuffer!)
104
+
105
+ do{
106
+
107
+ try myImageData!.write(to: URL(string: "/Users/私のユーザー名" + "/Pictures/test.jpeg")!)
108
+
109
+ }catch{
110
+
111
+ print(error);
112
+
113
+ }
114
+
115
+ })
116
+
117
+ ```
118
+
119
+ としたところ、
120
+
121
+ ```Log
122
+
123
+ [時刻][プロジェクト名][PIDと思われる番号] CFURLCopyResourcePropertyForKey failed because it was passed an URL which has no scheme
124
+
125
+ Error Domain=NSCocoaErrorDomain Code=518 "The file couldn’t be saved because the specified URL type isn’t supported." UserInfo={NSURL=/Users/[ユーザー名]/Pictures/test.jpeg}
126
+
127
+ ```
128
+
129
+ と出てきました。(機密情報は[]で隠させていただき概要だけ書いておきます。)

1

誤字です

2018/12/22 03:22

投稿

vsmorse
vsmorse

スコア68

test CHANGED
File without changes
test CHANGED
@@ -26,7 +26,7 @@
26
26
 
27
27
  do{
28
28
 
29
- try myImageData!.write(to: URL(string: NSHomeDirectory() + "/Pictures/test.jpeg")!)
29
+ try myImageData!.write(to: URL(string: "/Users/私のユーザー名" + "/Pictures/test.jpeg")!)
30
30
 
31
31
  }catch{
32
32
 
@@ -72,7 +72,7 @@
72
72
 
73
73
  /*do{
74
74
 
75
- try*/ myImageData!.write(to: URL(string: NSHomeDirectory() + "/Pictures/test.jpeg")!)
75
+ try*/ myImageData!.write(to: URL(string: "/Users/私のユーザー名" + "/Pictures/test.jpeg")!)
76
76
 
77
77
  /*}catch{
78
78