Using file manger new directory not working? [duplicate]
This question already has an answer here:
Create Directory in Swift 3.0
4 answers
iOS9 Swift File Creating NSFileManager.createDirectoryAtPath with NSURL
3 answers
Here is my code, but this code is not working is return me an error for permission.
let fileManager = FileManager.default
// Create 'subfolder' directory
do {
try fileManager.createDirectory(atPath: "subfolder", withIntermediateDirectories: true, attributes: nil)
}
catch let error as NSError {
print("Ooops! Something went wrong: (error)")
}
let documentsUrl:URL = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first as URL!
print("(documentsUrl)")
** error **
oops! Something went wrong: Error Domain=NSCocoaErrorDomain Code=513
"You don’t have permission to save the file “subfolder”."
ios swift
marked as duplicate by Kamran, Dharmesh
StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;
$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');
$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Nov 26 '18 at 6:57
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
add a comment |
This question already has an answer here:
Create Directory in Swift 3.0
4 answers
iOS9 Swift File Creating NSFileManager.createDirectoryAtPath with NSURL
3 answers
Here is my code, but this code is not working is return me an error for permission.
let fileManager = FileManager.default
// Create 'subfolder' directory
do {
try fileManager.createDirectory(atPath: "subfolder", withIntermediateDirectories: true, attributes: nil)
}
catch let error as NSError {
print("Ooops! Something went wrong: (error)")
}
let documentsUrl:URL = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first as URL!
print("(documentsUrl)")
** error **
oops! Something went wrong: Error Domain=NSCocoaErrorDomain Code=513
"You don’t have permission to save the file “subfolder”."
ios swift
marked as duplicate by Kamran, Dharmesh
StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;
$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');
$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Nov 26 '18 at 6:57
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
add a comment |
This question already has an answer here:
Create Directory in Swift 3.0
4 answers
iOS9 Swift File Creating NSFileManager.createDirectoryAtPath with NSURL
3 answers
Here is my code, but this code is not working is return me an error for permission.
let fileManager = FileManager.default
// Create 'subfolder' directory
do {
try fileManager.createDirectory(atPath: "subfolder", withIntermediateDirectories: true, attributes: nil)
}
catch let error as NSError {
print("Ooops! Something went wrong: (error)")
}
let documentsUrl:URL = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first as URL!
print("(documentsUrl)")
** error **
oops! Something went wrong: Error Domain=NSCocoaErrorDomain Code=513
"You don’t have permission to save the file “subfolder”."
ios swift
This question already has an answer here:
Create Directory in Swift 3.0
4 answers
iOS9 Swift File Creating NSFileManager.createDirectoryAtPath with NSURL
3 answers
Here is my code, but this code is not working is return me an error for permission.
let fileManager = FileManager.default
// Create 'subfolder' directory
do {
try fileManager.createDirectory(atPath: "subfolder", withIntermediateDirectories: true, attributes: nil)
}
catch let error as NSError {
print("Ooops! Something went wrong: (error)")
}
let documentsUrl:URL = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first as URL!
print("(documentsUrl)")
** error **
oops! Something went wrong: Error Domain=NSCocoaErrorDomain Code=513
"You don’t have permission to save the file “subfolder”."
This question already has an answer here:
Create Directory in Swift 3.0
4 answers
iOS9 Swift File Creating NSFileManager.createDirectoryAtPath with NSURL
3 answers
ios swift
ios swift
edited Nov 26 '18 at 15:48
rmaddy
245k27324388
245k27324388
asked Nov 26 '18 at 6:39
Digvijay GidaDigvijay Gida
127
127
marked as duplicate by Kamran, Dharmesh
StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;
$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');
$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Nov 26 '18 at 6:57
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
marked as duplicate by Kamran, Dharmesh
StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;
$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');
$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Nov 26 '18 at 6:57
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
I think, you should provide the full path of your new directory as like below.
let applicationDocumentsDirectory = NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true).last!
let fileManager = FileManager.default
do {
try fileManager.createDirectory(atPath: applicationDocumentsDirectory + "/subfolder", withIntermediateDirectories: true, attributes: nil)
}
catch let error as NSError {
print("Ooops! Something went wrong: (error)")
}
you have idea about different-different type collage frame in iOS ? @Natarajan
– Digvijay Gida
Nov 27 '18 at 6:00
thanks @Natarajan
– Digvijay Gida
Nov 27 '18 at 12:53
1
You are welcome!
– Natarajan
Nov 27 '18 at 13:49
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
I think, you should provide the full path of your new directory as like below.
let applicationDocumentsDirectory = NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true).last!
let fileManager = FileManager.default
do {
try fileManager.createDirectory(atPath: applicationDocumentsDirectory + "/subfolder", withIntermediateDirectories: true, attributes: nil)
}
catch let error as NSError {
print("Ooops! Something went wrong: (error)")
}
you have idea about different-different type collage frame in iOS ? @Natarajan
– Digvijay Gida
Nov 27 '18 at 6:00
thanks @Natarajan
– Digvijay Gida
Nov 27 '18 at 12:53
1
You are welcome!
– Natarajan
Nov 27 '18 at 13:49
add a comment |
I think, you should provide the full path of your new directory as like below.
let applicationDocumentsDirectory = NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true).last!
let fileManager = FileManager.default
do {
try fileManager.createDirectory(atPath: applicationDocumentsDirectory + "/subfolder", withIntermediateDirectories: true, attributes: nil)
}
catch let error as NSError {
print("Ooops! Something went wrong: (error)")
}
you have idea about different-different type collage frame in iOS ? @Natarajan
– Digvijay Gida
Nov 27 '18 at 6:00
thanks @Natarajan
– Digvijay Gida
Nov 27 '18 at 12:53
1
You are welcome!
– Natarajan
Nov 27 '18 at 13:49
add a comment |
I think, you should provide the full path of your new directory as like below.
let applicationDocumentsDirectory = NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true).last!
let fileManager = FileManager.default
do {
try fileManager.createDirectory(atPath: applicationDocumentsDirectory + "/subfolder", withIntermediateDirectories: true, attributes: nil)
}
catch let error as NSError {
print("Ooops! Something went wrong: (error)")
}
I think, you should provide the full path of your new directory as like below.
let applicationDocumentsDirectory = NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true).last!
let fileManager = FileManager.default
do {
try fileManager.createDirectory(atPath: applicationDocumentsDirectory + "/subfolder", withIntermediateDirectories: true, attributes: nil)
}
catch let error as NSError {
print("Ooops! Something went wrong: (error)")
}
answered Nov 26 '18 at 6:53
NatarajanNatarajan
2,29131126
2,29131126
you have idea about different-different type collage frame in iOS ? @Natarajan
– Digvijay Gida
Nov 27 '18 at 6:00
thanks @Natarajan
– Digvijay Gida
Nov 27 '18 at 12:53
1
You are welcome!
– Natarajan
Nov 27 '18 at 13:49
add a comment |
you have idea about different-different type collage frame in iOS ? @Natarajan
– Digvijay Gida
Nov 27 '18 at 6:00
thanks @Natarajan
– Digvijay Gida
Nov 27 '18 at 12:53
1
You are welcome!
– Natarajan
Nov 27 '18 at 13:49
you have idea about different-different type collage frame in iOS ? @Natarajan
– Digvijay Gida
Nov 27 '18 at 6:00
you have idea about different-different type collage frame in iOS ? @Natarajan
– Digvijay Gida
Nov 27 '18 at 6:00
thanks @Natarajan
– Digvijay Gida
Nov 27 '18 at 12:53
thanks @Natarajan
– Digvijay Gida
Nov 27 '18 at 12:53
1
1
You are welcome!
– Natarajan
Nov 27 '18 at 13:49
You are welcome!
– Natarajan
Nov 27 '18 at 13:49
add a comment |