teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

2

質問への追記

2018/12/22 03:22

投稿

vsmorse
vsmorse

スコア68

title CHANGED
File without changes
body CHANGED
@@ -44,4 +44,22 @@
44
44
  ![Call can throw. but it is not marked with 'try and the error'](43af9132bd0388d18c2b173e20d92dd4.png)
45
45
  ### 補足情報(FW/ツールのバージョンなど)
46
46
  macos Mojave version 10.14.1
47
- Xcode Version 10.1(10B61)
47
+ Xcode Version 10.1(10B61)
48
+ ※ファイルのパスを直書きしていますが、個人で使用するソフトウェアなので問題ありません。 
49
+ ###追記(MasakiHoriさんより)
50
+ > catch内をprint(error)に変えて出力されたエラーを質問に追加してください
51
+ ```Swift
52
+ let myImageData = AVCaptureStillImageOutput.jpegStillImageNSDataRepresentation(imageDataBuffer!)
53
+ do{
54
+ try myImageData!.write(to: URL(string: "/Users/私のユーザー名" + "/Pictures/test.jpeg")!)
55
+ }catch{
56
+ print(error);
57
+ }
58
+ })
59
+ ```
60
+ としたところ、
61
+ ```Log
62
+ [時刻][プロジェクト名][PIDと思われる番号] CFURLCopyResourcePropertyForKey failed because it was passed an URL which has no scheme
63
+ 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}
64
+ ```
65
+ と出てきました。(機密情報は[]で隠させていただき概要だけ書いておきます。)

1

誤字です

2018/12/22 03:22

投稿

vsmorse
vsmorse

スコア68

title CHANGED
File without changes
body CHANGED
@@ -12,7 +12,7 @@
12
12
  (imageDataBuffer,error) -> Void in
13
13
  let myImageData = AVCaptureStillImageOutput.jpegStillImageNSDataRepresentation(imageDataBuffer!)
14
14
  do{
15
- try myImageData!.write(to: URL(string: NSHomeDirectory() + "/Pictures/test.jpeg")!)
15
+ try myImageData!.write(to: URL(string: "/Users/私のユーザー名" + "/Pictures/test.jpeg")!)
16
16
  }catch{
17
17
  print("catch通過");//catchを通ったことがわかるように
18
18
  }
@@ -35,7 +35,7 @@
35
35
  ```Swift
36
36
  let myImageData = AVCaptureStillImageOutput.jpegStillImageNSDataRepresentation(imageDataBuffer!)
37
37
  /*do{
38
- try*/ myImageData!.write(to: URL(string: NSHomeDirectory() + "/Pictures/test.jpeg")!)
38
+ try*/ myImageData!.write(to: URL(string: "/Users/私のユーザー名" + "/Pictures/test.jpeg")!)
39
39
  /*}catch{
40
40
  print("catch通過");
41
41
  }*/