मैं copyItemAtPath के साथ निर्देशिकाओं की प्रतिलिपि बनाने की कोशिश कर रहा हूं, फिर भी जब भी यह "ऑपरेशन पूर्ण नहीं हो सका। फ़ाइल मौजूद है" त्रुटि।copyItemAtPath हमेशा फाइल के साथ विफल रहता है त्रुटि
यहाँ कोड मैं उपयोग कर रहा हूँ लॉग का
NSLog(@"Copying from: %@ to: %@", [[NSUserDefaults standardUserDefaults] objectForKey:@"template_1_path"], path);
if(![file_manager copyItemAtPath:[NSString stringWithFormat:@"%@", [[NSUserDefaults standardUserDefaults] objectForKey:@"template_1_path"]] toPath:[NSString stringWithFormat:@"%@", path] error:&error]) {
NSLog(@"%@" [error localizedDescription]);
}
उदाहरण है -
"Copying from: /Users/testuser/Sites/example_site to: /Users/testuser/Desktop"
"The operation couldn’t be completed. File exists"
मैं गलत क्या कर रही हूं पर कोई भी विचार?
अग्रिम धन्यवाद!
यह चाल के लिए भी सच है ItemAtPath: ... और moveItemAtURL: ... – LaborEtArs