के तहत फ़ोल्डर/फ़ाइल बनाने में असमर्थ मैं साझा कंटेनर पथ के तहत फ़ोल्डर/फ़ाइल बनाने के लिए निम्न कोड का उपयोग कर रहा हूं। जो ऐप एक्सटेंशन और ऐप युक्त एक्सटेंशन दोनों को डेटा तक पहुंचने में सहायता करेगा। किसी भी त्रुटि सफलता यह कहता है कि ऊपर उठाने नहीं एक निर्देशिकाआईओएस 8 ऐप समूह साझा कंटेनर स्थान
+(void)createDirAtSharedContainerPath
{
NSString *sharedContainerPathLocation = [[self getSharedContainerURLPath] absoluteString];
NSString *directoryToCreate = @"user_abc";
//basically this is <shared_container_file_path>/user_abc
NSString *dirPath = [sharedContainerPathLocation stringByAppendingPathComponent:directoryToCreate];
BOOL isdir;
NSError *error = nil;
NSFileManager *mgr = [[NSFileManager alloc]init];
if (![mgr fileExistsAtPath:dirPath isDirectory:&isdir]) { //create a dir only that does not exists
if (![mgr createDirectoryAtPath:dirPath withIntermediateDirectories:YES attributes:nil error:&error]) {
NSLog(@"error while creating dir: %@", error.localizedDescription);
} else {
NSLog(@"dir was created....");
}
}
}
ऊपर कोड बनाने के लिए
+(NSURL*)getSharedContainerURLPath
{
NSFileManager *fm = [NSFileManager defaultManager];
NSString *appGroupName = APP_EXTENSION_GROUP_NAME; /* For example */
NSURL *groupContainerURL = [fm containerURLForSecurityApplicationGroupIdentifier:appGroupName];
return groupContainerURL;
}
कोड, लेकिन मैं खोजने के लिए सक्षम नहीं हूँ:
कोड साझा कंटेनर यूआरएल स्थान प्राप्त करने के लिए साझा कंटेनर पथ के नीचे फ़ोल्डर। किसी भी विचार है कि
एक बार जब आप ऐप समूह सेट अप करते हैं तो निम्न लिंक में दिखाया गया है। http://blog.parse.com/announcements/introducing-local-data-sharing-for-apple-watch-and-app-extensions/ – Thiru
कृपया प्रश्न को स्वीकार के रूप में चिह्नित करें, ताकि सभी को पता चले कि यह समाधान @loganathan था –
यह मेरे लिए काम कर रहा है। Thanx – SPatel